1.1.1 ā€¢ Published 11 months ago

react-swipe-to-reveal-actions v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

A swipeable (list) item component that can reveal a set of actions - iOS style. Uses react-swipeable for gesture detection.

šŸ  Homepage

Demo-gif

Install

yarn add react-swipe-to-reveal-actions

Usage (see /example directory for more)

import SwipeToRevealActions from "react-swipe-to-reveal-actions";

export default const MyListItem = () => {
    return (
        <SwipeToRevealActions
            actionButtons={[
                {
                    content: (
                        <div className="your-className-here">
                            <span>EDIT</span>
                        </div>
                    ),
                    onClick: () => alert('Pressed the EDIT button'),
                },
                {
                    content: (
                        <div className="your-className-here">
                            <span>DELETE</span>
                        </div>
                    ),
                    onClick: () => alert('Pressed the DELETe button'),
                },
            ]}
            actionButtonMinWidth={70}
        >
            Swipe me to reveal actions
        </SwipeToRevealActions>
    );
};

Props

Required props are marked with *.

NameTypeDefaultDescription
children*React.ReactNode-The content of the item itself
actionButtons*{ content: React.ReactNode \ Element; onClick: () => void; role?: string; }[]-An array objects with the contents and onClicks for each action button
actionButtonMinWidth*number-The minimum width of each action button (px)
heightstring56pxThe height of the item. Can be px, rem or em - that's why this is a string
containerStyleReact.CSSProperties-Optional styles for the item container
onOpen() => void-Callback when item is expanded by swipe or click
onClose() => void-Callback when item is collapsed by swipe or click
hideDotsButtonboolean-Hides the three dots that can be clicked to expand the item
dotsBtnAriaLabelstringClick to reveal actionsa11y label text for the dots button

Author

šŸ‘¤ Nicklas Svendsrud

šŸ¤ Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2021 Nicklas Svendsrud. This project is MIT licensed.


This README was generated with ā¤ļø by readme-md-generator

1.1.1

11 months ago

1.1.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago