Dropdown Menu

@sushindustries/ui

A menu hung off a button: the popover API for the layer, arrow keys for the list, and light-dismiss for free.

7 min read
View as MarkdownEdit on GitHub

Props

PropTypeDefaultDoes
labelstring-The button's text. Also the menu's accessible name.
itemsreadonly DropdownItem[]-
onSelect(id: string) => void-Called with the item's id. Not called for a disabled item.
icon?IconName-Drawn in the button, before its label.
align?"start" | "end""start"Which edge the menu lines up with. end for a right-hand column.
buttonClassName?string"btn btn-quiet btn-sm"Replaces the button's classes, for a menu that is an icon in a table.
empty?string"Nothing to do here."Nothing to do here, said in the menu rather than by a missing button.

Notes

Anything the types cannot say: which combinations are meaningless, which prop is ignored when another is set, and what it does when handed something it cannot render.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content