Skip to Content

Menu

A dropdown menu built on Base UI’s Menu primitive. Supports plain items, groups, checkbox items, and radio groups. Animates with Motion when available, falls back to CSS transitions.

Import

import { Menu } from "chunks-ui";

Basic Usage

<Menu.Root> <Menu.Trigger>Options</Menu.Trigger> <Menu.Content> <Menu.Item>View profile</Menu.Item> <Menu.Item>Edit settings</Menu.Item> <Menu.Separator /> <Menu.Item>Sign out</Menu.Item> </Menu.Content> </Menu.Root>

Groups

Use Menu.Group with Menu.GroupLabel to organize items into labelled sections:

<Menu.Root> <Menu.Trigger>Actions</Menu.Trigger> <Menu.Content> <Menu.Group> <Menu.GroupLabel>File</Menu.GroupLabel> <Menu.Item>New file</Menu.Item> <Menu.Item>Open...</Menu.Item> </Menu.Group> <Menu.Separator /> <Menu.Group> <Menu.GroupLabel>Edit</Menu.GroupLabel> <Menu.Item>Undo</Menu.Item> <Menu.Item>Redo</Menu.Item> </Menu.Group> </Menu.Content> </Menu.Root>

Checkbox Items

Menu.CheckboxItem keeps a checked state. Pair with Menu.CheckboxItemIndicator to show a check mark:

<Menu.CheckboxItem checked={showGrid} onCheckedChange={setShowGrid}> <Menu.CheckboxItemIndicator>✓</Menu.CheckboxItemIndicator> Show grid </Menu.CheckboxItem>

Radio Group

Menu.RadioGroup enforces single selection among Menu.RadioItem children:

<Menu.RadioGroup value={theme} onValueChange={setTheme}> <Menu.RadioItem value="light"> <Menu.RadioItemIndicator>•</Menu.RadioItemIndicator> Light </Menu.RadioItem> <Menu.RadioItem value="dark"> <Menu.RadioItemIndicator>•</Menu.RadioItemIndicator> Dark </Menu.RadioItem> </Menu.RadioGroup>

Positioning

Menu.Content accepts positioning props forwarded to Base UI’s positioner:

<Menu.Content side="right" align="start" sideOffset={8}> ... </Menu.Content>

Compound Parts

PartDescription
Menu.RootState container. Manages open/close.
Menu.TriggerElement that opens the menu.
Menu.ContentPortal + positioner + popup panel. Default sideOffset={4}.
Menu.ItemA single actionable menu entry.
Menu.SeparatorHorizontal divider between groups of items.
Menu.GroupSemantic grouping wrapper for related items.
Menu.GroupLabelNon-interactive label for a Menu.Group.
Menu.CheckboxItemMenu item with a toggleable checked state.
Menu.CheckboxItemIndicatorVisual indicator shown when CheckboxItem is checked.
Menu.RadioGroupEnforces single selection among RadioItem children.
Menu.RadioItemSelectable item within a Menu.RadioGroup.
Menu.RadioItemIndicatorVisual indicator shown when RadioItem is selected.
Menu.ArrowSVG arrow pointing to the trigger.
PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"Preferred side relative to the trigger
sideOffsetnumber4Distance from the trigger
align"start" | "center" | "end""center"Alignment along the side
alignOffsetnumber0Offset from the alignment edge
classNamestringAdditional CSS classes
PropTypeDefaultDescription
disabledbooleanfalsePrevent interaction and dim the item
onClick() => voidCalled when the item is activated
classNamestringAdditional CSS classes
Last updated on