Menu
Menu with labels, separators, and destructive items.
Installation
npx @noarka/cli add menuUsage
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@noarka/ui";<DropdownMenu> <DropdownMenuTrigger render={<Button variant="outline">Options</Button>} /> <DropdownMenuContent align="start"> <DropdownMenuItem>Edit</DropdownMenuItem> <DropdownMenuItem>Duplicate</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem> </DropdownMenuContent></DropdownMenu>Examples
Checkbox items
Toggle options with check indicators. Uncontrolled via defaultChecked.
Radio items
Single-select groups with a shared defaultValue.
Submenu
Nest a submenu off any item trigger.
API reference
DropdownMenu
| Prop | Type | Default |
|---|---|---|
openControlled open state. Use with onOpenChange. | boolean | - |
defaultOpenInitially open when uncontrolled. | boolean | false |
onOpenChangeCalled when the menu opens or closes. | (open: boolean) => void | - |
onOpenChangeCompleteCalled after open or close animations finish. | (open: boolean) => void | - |
modalLock page scroll and outside interaction while open. | boolean | true |
disabledIgnore user interaction. | boolean | false |
DropdownMenuContent
| Prop | Type | Default |
|---|---|---|
sidePreferred placement side. | "top" | "right" | "bottom" | "left" | - |
sideOffsetGap between trigger and content. | number | 4 |
alignAlignment against the trigger edge. | "start" | "center" | "end" | "start" |
alignOffsetOffset along the alignment axis. | number | - |
renderPolymorphic render prop. Use to render a custom element instead of the default popup. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default content styles. | string | - |
DropdownMenuTrigger
| Prop | Type | Default |
|---|---|---|
renderRender a custom trigger element, e.g. render={<Button>Open menu</Button>}. | ReactElement | ((props) => ReactNode) | - |
disabledDisable the trigger. | boolean | false |
DropdownMenuItem
| Prop | Type | Default |
|---|---|---|
variantDestructive tints the item red. | "default" | "destructive" | "default" |
insetOffset content to align with labeled groups. | boolean | - |
onSelectBack-compat alias for onClick. The menu still closes on select unless closeOnClick is false. | (event) => void | - |
disabledDisable the item. | boolean | false |
renderPolymorphic render prop. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default item styles. | string | - |
DropdownMenuCheckboxItem
| Prop | Type | Default |
|---|---|---|
checkedControlled checked state. Use with onCheckedChange. | boolean | - |
defaultCheckedInitially checked when uncontrolled. | boolean | - |
onCheckedChangeCalled when the checked state changes. | (checked: boolean) => void | - |
disabledDisable the item. | boolean | false |
renderPolymorphic render prop. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default item styles. | string | - |
DropdownMenuRadioGroup
| Prop | Type | Default |
|---|---|---|
valueControlled selected value. Use with onValueChange. | string | - |
defaultValueInitially selected value when uncontrolled. | string | - |
onValueChangeCalled when the selection changes. | (value: string) => void | - |
disabledDisable the whole group. | boolean | false |
DropdownMenuRadioItem
| Prop | Type | Default |
|---|---|---|
valueRequiredValue set on the group when selected. | string | - |
disabledDisable the item. | boolean | false |
renderPolymorphic render prop. | ReactElement | ((props) => ReactNode) | - |
classNameAdditional classes merged with the default item styles. | string | - |
DropdownMenuLabel
| Prop | Type | Default |
|---|---|---|
insetOffset content to align with inset items. The label renders its own group, so it works directly inside content. | boolean | - |
classNameAdditional classes merged with the default label styles. | string | - |
DropdownMenuSeparator
| Prop | Type | Default |
|---|---|---|
orientationDivider direction. | "horizontal" | "vertical" | - |
classNameAdditional classes merged with the default separator styles. | string | - |
DropdownMenuShortcut
| Prop | Type | Default |
|---|---|---|
classNameAdditional classes merged with the shortcut hint styles. | string | - |
DropdownMenuSubTrigger
| Prop | Type | Default |
|---|---|---|
insetOffset content to align with inset items. | boolean | - |
disabledDisable the submenu trigger. | boolean | false |
classNameAdditional classes merged with the default trigger styles. | string | - |