0.6.0 • Published 8 months ago

slide-to-action v0.6.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Slide To Action

A simple slide to action React component.

demo

Installation

yarn add slide-to-action
# or with npm
npm install slide-to-action

Usage

import { SlideToAction } from 'slide-to-action';

const Save = () => <div>Save</div>;
const Delete = () => <div>Delete</div>;

const App = () => {
  return (
    <SlideToAction Content={<div>hello world</div>} actions={[Save, Delete]} />
  );
};

Props

NameTypeDefaultDescription
ContentReact.ReactNodeNoneThe content to be displayed.
actionsAction[]NoneThe actions to be displayed.
actionsWidthnumber0.35The width of the actions.
openFrom'Left''Right' | 'Left'The direction from which the actions will open.

Action Props

NameTypeDefaultDescription
indexnumberNoneThe index of the action.
progressnumberNoneThe progress of the action. (0-1.5)
close() => voidNoneA function to close the action.

TODO

  • Add tests
  • Add more examples
  • Remove actions & openFrom props and use actionsRight and actionsLeft instead
  • Add apply first action on swipe right/left
  • Provide actions components with utilities to handle animation
0.6.0

8 months ago

0.5.0

8 months ago