Dropdown
A compact menu that appears when triggered, offering a list of selectable options or actions.
Installation
Usage
API
Dropdown Props
For DropdownMenu Main
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | ReactNode[] | Root container for the dropdown menu. Must wrap Trigger and Content components. | - |
| defaultOpen | boolean | Controls whether the dropdown is open by default on initial render. | false |
| className | string | Additional CSS classes to customize the dropdown container styling. | - |
For DropdownMenu Trigger
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | Content displayed inside the trigger button that toggles the dropdown. | - |
| className | string | Additional CSS classes to customize the trigger button styling. | - |
For DropdownMenu Content
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | ReactNode[] | Container for dropdown menu items. Rendered only when the dropdown is open. | - |
| className | string | Additional CSS classes to customize the dropdown content styling. | - |
For DropdownMenu Item
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | Label or content displayed inside the dropdown item. | - |
| icon | ReactNode | Optional icon displayed before the item label. | - |
| onClick | (event: React.MouseEvent<HTMLButtonElement>) => void | Callback fired when the item is clicked. The dropdown closes automatically after execution. | - |
| className | string | Additional CSS classes to customize the dropdown item styling. | - |
Credits
This component is inspired by Rehman Kalawant Design Shared On Github.