Dropdown
Wraps a .dropdown-trigger button + .dropdown-menu panel with the WAI-ARIA menu-button interaction pattern (arrow keys, Home/End, Escape, outside-click, viewport-aware flip). Finds the two by class name — DropdownTrigger/DropdownMenu are a convenient way to produce that markup; hand-writing the .dropdown-* <div>s works exactly the same.
Usage
import { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, Divider } from '@mav-labs-inc/mavkit-react'
<Dropdown>
<DropdownTrigger>Options</DropdownTrigger>
<DropdownMenu aria-label="Options">
<DropdownItem>Edit</DropdownItem>
<DropdownItem>Duplicate</DropdownItem>
<Divider className="dropdown-separator" role="separator" aria-hidden="true" />
<DropdownItem as="button" danger>Delete</DropdownItem>
</DropdownMenu>
</Dropdown>Examples
Basic
Hover trigger
Falls back to click on touch devices ((hover: none)) automatically.
Props
Dropdown
DropdownTrigger
Renders a .btn.dropdown-trigger button and accepts every native <button> attribute. Dropdown manages aria-expanded on it directly — don’t set that prop yourself.
DropdownMenu
Also accepts every native <div> attribute. Give it an aria-label (or aria-labelledby) — the menu has no visible heading of its own.
DropdownItem
Also accepts every native <a>/<button> attribute (whichever as renders).