"use client";
import { Menu } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items | readonly MenuAction[] | — | Items to render. |
container | Element | DocumentFragment | null | — | Portal container when portal is set. |
defaultOpen | boolean | — | Initial open state when uncontrolled. |
label | ReactNode | — | Visible label (also the accessible name). |
onAction | (id: string) => void | — | Called with the id of the activated command (any leaf item). |
onOpenChange | (open: boolean) => void | — | Called with the next open state. |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
open | boolean | — | Open state (controlled). |
placement | FloatingPlacement | — | Where it sits relative to its anchor (start/end follow the writing direction). |
portal | boolean | — | Render the list in a portal (use inside transformed/clipped containers). |
showIndicator | boolean | true | Chevron on the default trigger button (default true). |
trigger | ReactElement | — | Custom trigger element (defaults to a MenuButton with label). |
itemsreadonly MenuAction[]
Items to render.
containerElement | DocumentFragment | null
Portal container when portal is set.
defaultOpenboolean
Initial open state when uncontrolled.
labelReactNode
Visible label (also the accessible name).
onAction(id: string) => void
Called with the id of the activated command (any leaf item).
onOpenChange(open: boolean) => void
Called with the next open state.
onValueChange(value: string) => void
Called with the new value (only when it changes).
openboolean
Open state (controlled).
placementFloatingPlacement
Where it sits relative to its anchor (start/end follow the writing direction).
portalboolean
Render the list in a portal (use inside transformed/clipped containers).
showIndicatordefault trueboolean
Chevron on the default trigger button (default true).
triggerReactElement
Custom trigger element (defaults to a MenuButton with label).
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const actions = [
{ id: "copy", label: "Copy" },
{ id: "rename", label: "Rename" },
];
<Menu items={actions} />