React Expandify ๐
Animated, lightweight expandable components for React. No extras, just effortless expand and collapse.
๐ธ Demo
๐ Features
- ๐ Plug and Play: Get started instantly, no complicated setup!
- ๐ Elemental Freedom: Use any HTML element as your expandable container.
- ๐จ Your Style, Your Rules: Easy-to-add custom classes.
- โฑ Tick Tock Goes The Clock: Control the expand and collapse speed to the millisecond!
๐ฆ Installation
Add React Expandify
to your project with npm:
npm install react-expandify
Or use yarn:
yarn add react-expandify
๐ก Usage
Basic example:
import { Expandable } from 'react-expandify'; import 'react-expandify/dist/style.css'; const MyApp = () => ( <Expandable expanded> <p>Your awesome content here!</p> </Expandable> );
๐ Documentation
PropertyTypeDefaultDescriptionexpandedbooleanfalse
Determines whether the content is expanded or not.childrenReactNode
โChildren to be rendered inside the component.elementTypeJSX.IntrinsicElements'div'
The HTML element type for the Expandable component.expandDurationnumber300
Duration for the expand animation in milliseconds.collapseDurationnumber300
Duration for the collapse animation in milliseconds.easingstringease-in-out
Easing function for the expand and collapse animations.classNamestring
โAdditional className for the Expandable component.onCollapse() => void
โCallback when the content has collapsed.onExpand() => void
โCallback when the content has expanded.
โจ What You Can Create
Tree view
Accordion component
Toggles
More examples coming soonโฆ
๐ Contributing
Got ideas or bug reports? Open an issue or send a pull request!
๐ License
Licensed under the MIT License. See LICENSE for more details.
Crafted with ๐ by Armen Nersisyan