"use client";
import { CommandDialog } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
options (required) | readonly PixxlAction[] | — | Options to choose from. |
trigger | ReactElement | — | Element that opens the dialog (gets aria-expanded/aria-controls). |
closeOnRun | boolean | true | Close after a command runs (default true). |
container | Element | DocumentFragment | null | document.body | Portal container (default document.body). |
defaultOpen | boolean | — | Initial open state when uncontrolled. |
defaultQuery | string | — | Initial search text (uncontrolled). |
defaultValue | string | — | Initial value when uncontrolled. |
emptyLabel | ReactNode | — | Shown when no command matches the query. |
filter | (option: PixxlAction, query: string) => boolean | case-insensitive label substring | Custom matcher (default: case-insensitive label substring). |
inputLabel | string | — | — |
optionsrequiredreadonly PixxlAction[]
Options to choose from.
triggerReactElement
Element that opens the dialog (gets aria-expanded/aria-controls).
closeOnRundefault trueboolean
Close after a command runs (default true).
containerdefault document.bodyElement | DocumentFragment | null
Portal container (default document.body).
defaultOpenboolean
Initial open state when uncontrolled.
defaultQuerystring
Initial search text (uncontrolled).
defaultValuestring
Initial value when uncontrolled.
emptyLabelReactNode
Shown when no command matches the query.
filterdefault case-insensitive label substring(option: PixxlAction, query: string) => boolean
Custom matcher (default: case-insensitive label substring).
inputLabelstring
const commands = [
{ id: "new", label: "New file" },
{ id: "open", label: "Open…" },
];
<CommandDialog options={commands} trigger={<Button>Commands</Button>} />