Command
⌘K command palette (cmdk).
Import
import { Command } from "@cronus-ui/ui";
npx cronus-ui add command
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component CommandDefault layout:inline style:command {
label "Command menu"
text "Type a command…"
text "Calendar"
text "Search"
}
page "/audit/command/default" type:custom {
use CommandDefault
}
API Reference
Generated from the component's exported types.
CommandDialogProps
Extends ComponentProps<typeof Dialog>
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Command Menu" | — |
description | string | "Search for a command to run..." | — |
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
CommandProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive>
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |
CommandInputProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |
CommandListProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive.List>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |
CommandEmptyProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |
CommandGroupProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |
CommandItemProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |
CommandShortcutProps
Extends ComponentProps<"span">
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
CommandSeparatorProps
Extends ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
value | string | — | Controlled value. |
onValueChange | (value: string) => void | — | Called when the value changes. |
loop | boolean | — | — |
label | string | — | Accessible name of the command list. |