# CommandPalette

Supply UI 1.1.0. Showing things.

Search for a page or an action and run it from the keyboard (⌘K). Once, in the layout

Search for a page or an action and run it from the keyboard. Put it once in the layout.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `items` (needed) | `CommandItem[]` |  | The pages and actions to search: each an `id`, a `label`, and an `href` to go to or an `onSelect` to run. |
| `empty` | `ReactNode` |  | Shown when nothing matches. |
| `hotkey` | `boolean` | `true` | Opens with ⌘K (Ctrl K on Windows). On by default. |
| `onOpenChange` | `(open: boolean) => void` |  | Called with true or false when it opens or closes. |
| `open` | `boolean` |  | Whether it is open, when your state holds it; use with `onOpenChange`. |
| `placeholder` | `string` |  | A hint shown while it is empty. Not a label: give it a label as well. |

## Without React

Classes: (React only)

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/button.css`, `components/card.css`, `components/table.css`, `components/tabs.css`, `components/popups.css`, `components/dialog.css`, `components/icons.css`, `components/input-group.css`, `components/calendar.css`, `components/button-group-toggle.css`, `components/code-input.css`, `components/tab-bar.css`, `components/command-palette.css`, `components/prose.css`, `components/carousel-arrows.css`, `components/page-transitions.css`, `parts/carousel.css`, `parts/calendar.css`, `parts/date-time-typed-part.css`, `parts/listbox.css`, `parts/date-picker.css`, `parts/board.css`, besides the ones every page loads.

## In the examples

- Jump anywhere with ⌘K: Pages and actions in one search (https://www.supply.family/ui/#scene-jump)

## Showing things: notes

**States.** Lists, tables and boards have three more states besides their content: empty (`Empty`, with the first action inside), loading (`Skeleton`) and failed (`Alert tone="danger"`). A chosen row shows in ink, never in the brand colour.

**Do**
- Put numbers, dates and codes in `ui-mono` (in a table cell, `ui-num`, which also aligns them).
- Let a `Table` turn into blocks on a phone; give it `scroll` only when it is read down its columns.
- Show a status in words and colour together (`Badge tone="success"` with "Paid"), never colour alone.

**Don't**
- Don't put a card round a `Table`, `List`, `Cells`, `Calendar` or `Empty`: they draw their own box.
- Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
- Don't use the status colours (success, warning, danger, info) for anything but those meanings.
