Menu

Menu with labels, separators, and destructive items.

Installation

npx @noarka/cli add menu

Usage

tsx
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@noarka/ui";
tsx
<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

PropTypeDefault
open

Controlled open state. Use with onOpenChange.

boolean-
defaultOpen

Initially open when uncontrolled.

booleanfalse
onOpenChange

Called when the menu opens or closes.

(open: boolean) => void-
onOpenChangeComplete

Called after open or close animations finish.

(open: boolean) => void-
modal

Lock page scroll and outside interaction while open.

booleantrue
disabled

Ignore user interaction.

booleanfalse

DropdownMenuContent

PropTypeDefault
side

Preferred placement side.

"top" | "right" | "bottom" | "left"-
sideOffset

Gap between trigger and content.

number4
align

Alignment against the trigger edge.

"start" | "center" | "end""start"
alignOffset

Offset along the alignment axis.

number-
render

Polymorphic render prop. Use to render a custom element instead of the default popup.

ReactElement | ((props) => ReactNode)-
className

Additional classes merged with the default content styles.

string-

DropdownMenuTrigger

PropTypeDefault
render

Render a custom trigger element, e.g. render={<Button>Open menu</Button>}.

ReactElement | ((props) => ReactNode)-
disabled

Disable the trigger.

booleanfalse

DropdownMenuItem

PropTypeDefault
variant

Destructive tints the item red.

"default" | "destructive""default"
inset

Offset content to align with labeled groups.

boolean-
onSelect

Back-compat alias for onClick. The menu still closes on select unless closeOnClick is false.

(event) => void-
disabled

Disable the item.

booleanfalse
render

Polymorphic render prop.

ReactElement | ((props) => ReactNode)-
className

Additional classes merged with the default item styles.

string-

DropdownMenuCheckboxItem

PropTypeDefault
checked

Controlled checked state. Use with onCheckedChange.

boolean-
defaultChecked

Initially checked when uncontrolled.

boolean-
onCheckedChange

Called when the checked state changes.

(checked: boolean) => void-
disabled

Disable the item.

booleanfalse
render

Polymorphic render prop.

ReactElement | ((props) => ReactNode)-
className

Additional classes merged with the default item styles.

string-

DropdownMenuRadioGroup

PropTypeDefault
value

Controlled selected value. Use with onValueChange.

string-
defaultValue

Initially selected value when uncontrolled.

string-
onValueChange

Called when the selection changes.

(value: string) => void-
disabled

Disable the whole group.

booleanfalse

DropdownMenuRadioItem

PropTypeDefault
valueRequired

Value set on the group when selected.

string-
disabled

Disable the item.

booleanfalse
render

Polymorphic render prop.

ReactElement | ((props) => ReactNode)-
className

Additional classes merged with the default item styles.

string-

DropdownMenuLabel

PropTypeDefault
inset

Offset content to align with inset items. The label renders its own group, so it works directly inside content.

boolean-
className

Additional classes merged with the default label styles.

string-

DropdownMenuSeparator

PropTypeDefault
orientation

Divider direction.

"horizontal" | "vertical"-
className

Additional classes merged with the default separator styles.

string-

DropdownMenuShortcut

PropTypeDefault
className

Additional classes merged with the shortcut hint styles.

string-

DropdownMenuSubTrigger

PropTypeDefault
inset

Offset content to align with inset items.

boolean-
disabled

Disable the submenu trigger.

booleanfalse
className

Additional classes merged with the default trigger styles.

string-