NeoTerm UI

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

PropTypeDefaultDescription
triggerReactNodeElement that opens the dropdown.
items(DropdownItem | "separator")[]Menu items.
align"start" | "end""start"Horizontal alignment.

DropdownItem

PropTypeDefaultDescription
idstringUnique identifier.
labelstringItem text.
iconReactNodeLeading icon.
shortcutstringShortcut hint.
disabledbooleanDisable the item.
dangerbooleanDestructive styling.
onSelect() => voidSelection handler.