Dropdown
Simple dropdown menu triggered by any element.
Import
import { Dropdown } from "neoterm-ui";Usage
<Dropdown
trigger={<Button>Actions</Button>}
items={[
{ id: "edit", label: "Edit", onSelect: () => {} },
{ id: "copy", label: "Copy", shortcut: "⌘C", onSelect: () => {} },
"separator",
{ id: "delete", label: "Delete", danger: true, onSelect: () => {} },
]}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| trigger | ReactNode | — | Element that opens the dropdown. |
| items | (DropdownItem | "separator")[] | — | Menu items. |
| align | "start" | "end" | "start" | Horizontal alignment. |
DropdownItem
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | — | Unique identifier. |
| label | string | — | Item text. |
| icon | ReactNode | — | Leading icon. |
| shortcut | string | — | Shortcut hint. |
| disabled | boolean | — | Disable the item. |
| danger | boolean | — | Destructive styling. |
| onSelect | () => void | — | Selection handler. |