Collapse Component
The Collapse
component is a React component designed to create collapsible
sections with various customization options. It supports different variants
such as toggle, checkbox, and focus, providing flexibility in its usage.
Example Preview
Usage
Import the Collapse
component and use it in your React application:
import { Collapse } from "@/@core";
const MyComponent = () => {
return (
<Collapse
title="Section Title"
description="Section Description"
icon="default"
type="default"
variant="focus"
>
{/* Your content goes here */}
</Collapse>
);
};
export default MyComponent;
Props
Prop Name | Type | Default Value | Required | Description |
---|---|---|---|---|
title | string | - | Yes | The title of the collapsible section. |
description | string , React.ReactNode | - | Yes | The description or content of the collapsible section. |
icon | 'default' , 'plus' , 'arrow' | 'default' | No | Icon variant for the collapsible section. |
type | 'default' , 'open' , 'close' | 'default' | No | Type variant for the collapsible section. |
variant | 'toggle' , 'checkbox' , 'focus' | 'toggle' | No | The type of the collapsible section. |
children | React.ReactNode | - | No | Additional content to be displayed inside the collapsible section. |
Additional Props
Refer to the HTMLAttributes<HTMLDivElement>
interface for standard HTML div element attributes. Additionally, the VariantProps<typeof CollapseVariants>
interface is used to handle variant-specific
props.
Examples
Check the provided MyComponent
example for basic usage, and customize the component based on your specific needs.
Note: The Collapse
component inspired by the DaisyUI (opens in a new tab)
framework. Check it out for more awesome components. But our Collapse
component is dynamic and easy to use. It is also fully customizable.