Skip to main content

Dropdown

Wraps a trigger element and reveals a floating Menu on hover or click. Pass the trigger as children and the menu via the menu prop (its items support nested submenus).

import { Button, Dropdown } from '@jbpark/ui-kit';

<Dropdown
trigger="click"
menu={{
items: [
{ key: 'edit', label: 'Edit' },
{ key: 'delete', label: 'Delete' },
],
}}
>
<Button>Menu</Button>
</Dropdown>;

Props

PropTypeDefault
trigger'hover' | 'click''hover'
menuMenuProps-
openboolean (controlled)-
onOpenChange(open: boolean) => void-
classNamestring-
childrenReactNode (the trigger)-

Dropdown also accepts the rest of React.ComponentProps<'div'>. Provide open together with onOpenChange for controlled usage.

FieldTypeNotes
itemsMenuItem[]{ key, label, children? }
onClick(params) => voidparams.key / keyPath / item
mode'horizontal' | 'vertical' | 'inline'-
classNames{ rootItem?; subMenu?; item?; label? }-

The menu prop is forwarded directly to the underlying Menu component, so any MenuProps are accepted — see Menu for the full API.