Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Overlays & Actions

Command

Command palette surface: filterable list via `CommandInput` + `value` on each `CommandItem`. Official shadcn uses `cmdk` (React); Kamod implements the same UX with Preact signals and `data-match` visibility for `CommandEmpty`. Reveal the right amount of context without losing the user's place in the interface. Keep the trigger, content and dismissal behavior working as one interaction. Import it from @/components/kamod-ui/command.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Use @kamod-ch/ui — no cmdk dependency. For modal palettes, wrap with CommandDialog (Dialog + padded DialogContent).

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

CommandItem requires a value string used for filtering (case-insensitive substring). Use onSelect or onClick for actions. CommandEmpty appears only when the query is non-empty and no item matches. CommandList measures matches after layout. Inside CommandDialog, drop the inner Command border: class="rounded-none border-0 shadow-none".

Import SetupTypeScript
import { Command } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Command in Different Contexts, from the starting pattern to the compositions below. Begin with Inline Demo, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Inline Demo

Organize Commands Around Tasks. Compose a command list from groups, separators, shortcuts and icons to make available actions searchable. The inline example keeps the list in the page, allowing you to inspect its organization before adding a dialog layer.

Connect each item's selection handler to a real action, provide a clear empty state, and remember that a displayed shortcut does not register a keyboard listener by itself.

src/components/CommandExample.tsx1 line
// command-doc.tsx — CommandDemoPreview

Dialog: Basic

Keep the Command Surface Easy to Enter and Leave. Use CommandDialog with controlled open and onOpenChange when the command palette should appear over the current screen. The command list owns its choices while the parent decides when the palette is available.

Name the launcher, preserve dismissal and focus return, and keep command execution separate from the dialog's visibility state so actions do not accidentally run twice.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Dialog: Shortcuts

Advertise Shortcuts that Actually Exist. Add CommandShortcut beside an action label to show a keyboard hint in a consistent trailing position. The hint documents a shortcut; the application must still register and handle that key combination where appropriate.

Avoid conflicting with browser or assistive-technology shortcuts, and keep a normal selectable command available for people who do not use the advertised key sequence.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Dialog: Groups

Separate Frequent Suggestions from Broader Settings. Separate suggestions and settings with named groups and CommandSeparator. This preserves the relationship between related actions, helping readers interpret the list even before they begin filtering its contents.

Keep category names stable and remove empty groups when appropriate; commands should remain understandable when search results appear outside their original context.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Dialog: Scrollable

Constrain the List without Hiding Navigation. Constrain CommandList with max-h-80 when many actions would otherwise make the palette too tall. The surrounding dialog stays compact while the results form a scrollable area within it.

Test keyboard movement into offscreen items and long labels, and keep the search field and empty-result feedback visible without requiring users to scroll the entire page.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Command using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/command41.6 KB min · 10.1 KB gzipSignals: direct@preact/signals

Command

CommandProps

Command documented props
Prop / typeDescription
autoHighlight
booleanCommandProps

First visible item gets `data-highlighted`; enables ArrowUp/Down + Enter in `CommandInput`.

Default
false
children
ComponentChild[] | ComponentChildCommandProps

Configure children for Command. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>CommandProps

Configure class for Command. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
hasVisibleItems
Signal<boolean>CommandProps

External visibility signal; updated by `CommandList` when provided.

Default
—
query
Signal<string>CommandProps

External filter signal (e.g. combobox inline input shares query with the list).

Default
—

CommandDialog

CommandDialogProps

CommandDialog documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCommandDialogProps

Configure children for CommandDialog. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
contentClass
stringCommandDialogProps

Passed to `DialogContent` for width (default command palette sizing).

Default
"gap-0 overflow-hidden p-0 sm:max-w-lg"
defaultOpen
booleanCommandDialogProps

Configure defaultOpen for CommandDialog. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onOpenChange
((open: boolean) => void)CommandDialogProps

Configure onOpenChange for CommandDialog. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
open
booleanCommandDialogProps

Configure open for CommandDialog. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

CommandEmpty

CommandEmptyProps

CommandEmpty documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCommandEmptyProps

Configure children for CommandEmpty. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>CommandEmptyProps

Configure class for CommandEmpty. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

CommandGroup

CommandGroupProps

CommandGroup documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCommandGroupProps

Configure children for CommandGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>CommandGroupProps

Configure class for CommandGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
heading
stringCommandGroupProps

Configure heading for CommandGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

CommandInput

CommandInputProps

CommandInput documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CommandInputProps

Configure class for CommandInput. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onInput
InputEventHandler<HTMLInputElement>CommandInputProps

Configure onInput for CommandInput. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLInputElement>CommandInputProps

Configure onKeyDown for CommandInput. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

CommandItem

CommandItemProps

CommandItem documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCommandItemProps

Configure children for CommandItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>CommandItemProps

Configure class for CommandItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disabled
boolean | SignalLike<boolean | undefined>CommandItemProps

Configure disabled for CommandItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>CommandItemProps

Configure onClick for CommandItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onSelect
(GenericEventHandler<HTMLButtonElement> & ((value: string) => void))CommandItemProps

Configure onSelect for CommandItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
Signalish<string | number | undefined> & stringCommandItemProps

Used for case-insensitive filtering against the query.

Default
—

CommandList

CommandListProps

CommandList documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCommandListProps

Configure children for CommandList. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>CommandListProps

Configure class for CommandList. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onMount
((el: HTMLDivElement | null) => void)CommandListProps

Notified when the list root mounts (e.g. combobox inline input forwards keyboard to the list).

Default
—

CommandSeparator

CommandSeparatorProps

CommandSeparator documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>CommandSeparatorProps

Configure class for CommandSeparator. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

CommandShortcut

CommandShortcutProps

CommandShortcut documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildCommandShortcutProps

Configure children for CommandShortcut. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>CommandShortcutProps

Configure class for CommandShortcut. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

CommandContextValue

7 declared fields
CommandContextValue
Exported Source Declaration from Command.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandContextValue before adapting it.
Required fields
query, hasVisibleItems, autoHighlight, highlightedIndex, listRef, moveHighlight, activateHighlighted

Command Props

4 declared fields
CommandProps
Exported Source Declaration from Command.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandProps before adapting it.

CommandDialog Props

5 declared fields
CommandDialogProps
Exported Source Declaration from CommandDialog.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandDialogProps before adapting it.

CommandEmpty Props

1 declared field
CommandEmptyProps
Exported Source Declaration from CommandEmpty.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandEmptyProps before adapting it.

CommandGroup Props

2 declared fields
CommandGroupProps
Exported Source Declaration from CommandGroup.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandGroupProps before adapting it.

CommandInput Props

Declaration
CommandInputProps
Exported Source Declaration from CommandInput.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandInputProps before adapting it.

CommandItem Props

3 declared fields
CommandItemProps
Exported Source Declaration from CommandItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandItemProps before adapting it.
Required fields
value

CommandList Props

2 declared fields
CommandListProps
Exported Source Declaration from CommandList.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandListProps before adapting it.
CommandSeparatorProps
Exported Source Declaration from CommandSeparator.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandSeparatorProps before adapting it.

CommandShortcut Props

1 declared field
CommandShortcutProps
Exported Source Declaration from CommandShortcut.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of CommandShortcutProps before adapting it.

Accessibility

Build the Complete Interaction, Including the Parts Outside Command. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

Command filters button items through a native input. autoHighlight defaults to false; when enabled, CommandInput handles Up/Down and Enter for highlighted-item activation. The implementation should not be described as a complete combobox/listbox pattern by default.

Labels and Relationships

Label the search input independently of its placeholder, and write action names that stand on their own. Shortcuts are supplementary hints. Group headings help sighted scanning, but verify their relationships in the rendered accessibility tree.

Keyboard and Focus

With autoHighlight off, keep matching item buttons reachable through ordinary focus. With it on, verify that highlight movement and activation remain understandable to screen-reader users as well as visually. Test an empty query, no results and disabled matches.

States and Integration Details

A highlighted background is not automatically an announced active descendant. If embedding Command in a dialog, the outer dialog still needs a name, dismissal and focus return. Do not imply unavailable shortcuts or selection semantics through decorative text.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Search and activate an enabled result using each configured keyboard path.
  2. Read result changes with a screen reader and inspect whether the highlighted result is conveyed.
  3. Clear the query, disable a matching action and close any enclosing dialog without losing focus.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.