Components
Menu
Action menu with icons, descriptions, checkbox and radio items, submenus and a danger tone.
import { Button, Menu } from "@openperf/deft";
<Menu.Root>
<Menu.Trigger render={<Button.Root />}>Project</Menu.Trigger>
<Menu.Content>
<Menu.Item>Rename</Menu.Item>
<Menu.Item tone="danger">Delete</Menu.Item>
</Menu.Content>
</Menu.Root>;When to use
| Need | Component |
|---|---|
| Run a command, or flip a setting that applies right away | Menu |
| Pick a value for a form | Select |
| Pick a value from a list that needs a search field | Combobox |
| Free-form content in a popup | Popover |
Anatomy
<Menu.Root>
<Menu.Trigger /> {/* unstyled — pass a Button through render */}
<Menu.Content>
{/* portal, positioner and popup in one part */}
<Menu.Group>
<Menu.GroupLabel />
<Menu.Item />
<Menu.CheckboxItem />
</Menu.Group>
<Menu.Separator />
<Menu.RadioGroup>
<Menu.RadioItem />
</Menu.RadioGroup>
<Menu.SubmenuRoot>
<Menu.SubmenuTrigger />
<Menu.Content /> {/* the submenu popup */}
</Menu.SubmenuRoot>
<Menu.Footer /> {/* row at the bottom, children spread to both ends */}
</Menu.Content>
</Menu.Root>Set aria-label on an icon-only trigger. Every other Base UI Menu export is available on Menu unchanged and unstyled.
Item content
A Tabler icon placed before the label is sized to 14px and tinted by the item.
| Part | Content props | Right edge | Click closes the menu |
|---|---|---|---|
Menu.Item | description, trailing, size, tone | trailing | Yes |
Menu.CheckboxItem | description, trailing, size | trailing | No |
Menu.RadioItem | description, size | Check mark while selected | No |
Menu.SubmenuTrigger | description | Chevron | No, opens the submenu |
Radio groups
Menu.RadioGroup holds one value (value, defaultValue, onValueChange). Put a Menu.GroupLabel inside the group to name it.
Composition
Links and dialogs
Pass a router link to render on Menu.Item to navigate, or Dialog.Trigger to open a Dialog or a Confirm dialog.
Detached trigger
When the trigger lives in another component, create a handle with Menu.createHandle() and pass it as handle to both Menu.Root and Menu.Trigger. Type the handle with MenuHandle<Payload>.
API
Menu.Root
Prop
Type
Menu.Content
The popup is at least 160px wide. Set a fixed width through className.
Prop
Type
Menu.Item
Prop
Type
Menu.CheckboxItem, Menu.RadioItem & Menu.SubmenuTrigger
Each takes the content props listed under Item content, plus its Base UI props: checked, defaultChecked and onCheckedChange on Menu.CheckboxItem, a required value on Menu.RadioItem.