Component docs
Loading
"use client";
import { ActionList } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items (required) | readonly ActionListItem[] | — | Items to render. |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
defaultValue | string | null | — | Selected id when uncontrolled. |
onAction | (id: string) => void | — | Called with the id of the activated command or option. |
value | string | null | — | Selected id (controlled); null for none. |
itemsrequiredreadonly ActionListItem[]
Items to render.
onValueChange(value: string) => void
Called with the new value (only when it changes).
defaultValuestring | null
Selected id when uncontrolled.
onAction(id: string) => void
Called with the id of the activated command or option.
valuestring | null
Selected id (controlled); null for none.
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" },
];
const [action, setAction] = useState<string | null>(null);
<ActionList items={actions} onValueChange={setAction} />