react-ts-accordion-component
v1.0.0
Published
A customizable React Accordion component
Downloads
96
Maintainers
Readme
React Accordion Component
A customizable and animated accordion component for React applications.
Installation
npm install react-ts-accordion-component
Usage
import React from 'react';
import { Accordion } from 'react-ts-accordion-component';
import { FaUser } from 'react-icons/fa';
function App() {
return (
<Accordion
title='User Profile'
icon={<FaUser />}
theme='light'
iconPosition='left'
>
<p>Manage your user profile settings here.</p>
</Accordion>
);
}
export default App;
Props
title
: string (required) - The title of the accordionchildren
: ReactNode (required) - The content of the accordionicon
: ReactNode - An optional icon to display next to the titledefaultIsOpen
: boolean - Whether the accordion is open by defaultonExpand
: function - Callback function when the accordion is expandedlocked
: boolean - Whether the accordion is locked (cannot be opened)onRenderTitle
: function - Custom render function for the titletheme
: 'light' | 'dark' - The color theme of the accordioniconPosition
: 'left' | 'right' - The position of the icon
Examples
For more examples and a live demo, visit our example site.
License
MIT
Support
If you encounter any issues or have questions, please file an issue on our GitHub repository.