@kitn.ai/ui
Version:
Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.
34 lines (33 loc) • 1.2 kB
TypeScript
import { JSX } from 'solid-js';
export interface CommandRow {
id: string;
label: string;
icon?: string;
description?: string;
/** Optional keyboard shortcut shown as right-aligned key caps; uses the
* kai-kbd `keys` syntax (e.g. "Mod+K", "Alt+1"). */
shortcut?: string;
}
export interface CommandGroup {
group?: string;
items: CommandRow[];
}
export interface CommandListProps {
groups: CommandGroup[];
activeId?: string;
onSelect: (id: string) => void;
emptyLabel?: string;
/** Accessible label for the listbox container. Defaults to 'Command palette'. */
ariaLabel?: string;
/** id applied to the listbox container, for aria-controls wiring. */
id?: string;
}
/**
* `CommandList` — a presentational grouped listbox for command/mention palettes.
*
* Renders a `role="listbox"` container. Groups with a `group` name get a muted
* section header. Each row is a `role="option"` button with icon, label, and
* optional description. Clicking a row calls `onSelect(id)`. When there are no
* groups/items it renders `emptyLabel` (default "No results").
*/
export declare function CommandList(props: CommandListProps): JSX.Element;