---
title: CommandPalette
description: Search grouped commands and navigation targets from an inline surface.
package: moraine
version: 0.11.0
repository: https://github.com/subframe7536/moraine
---

# CommandPalette

> Search grouped commands and navigation targets from an inline surface.

## Anatomy

```text
CommandPalette [component; slot=root]
├── inputWrapper [slot]
│   ├── inputLeading [slot]
│   ├── input [slot]
│   └── close [slot]
├── listbox [slot]
│   ├── group [slot]
│   │   ├── groupLabel [slot]
│   │   └── item [slot]
│   │       ├── itemLeading [slot]
│   │       ├── itemWrapper [slot]
│   │       │   ├── itemLabel [slot]
│   │       │   └── itemDescription [slot]
│   │       └── itemTrailing [slot]
│   └── empty [slot]
└── footer [slot]
```

Group labels and items flatten into sibling rows when virtualized. With `descriptionPosition: 'trailing'`, the description renders inside `itemLabel`.

## Usage

Use CommandPalette for searchable commands or navigation targets on an inline surface. The
application decides when to open it and registers any global shortcut. Wrap it in a
[Dialog](https://moraine.subf.dev/components/dialog.md) or [BaseDialog](https://moraine.subf.dev/components/base-dialog.md) when the palette should occupy a focused
overlay; the wrapper also owns Escape dismissal. Use [NavigationMenu](https://moraine.subf.dev/components/navigation-menu.md)
for persistent site destinations.

```tsx
import { CommandPalette } from 'moraine'

export function Example() {
  return (
    <CommandPalette
      items={[{ type: 'group', label: 'Pages', items: [{ value: 'settings', label: 'Settings' }] }]}
    />
  )
}
```

### Groups, filtering, and selection

Pass items and groups from application state. The palette filters the supplied collection and calls
the item's `onSelect`, then the palette's `onSelect`. Fetching commands, routing, and global
shortcuts stay with the application. The default `filterMethod` is `'contains'`; it matches the
item's label, value, description, and `keywords` ignoring case and accents. Pass `'startsWith'`,
`'endsWith'`, or a predicate for custom matching, or `false` to skip filtering when you already
filter the collection. Set `alwaysShow` on an item to keep it visible for any query.

```tsx
<CommandPalette
  placeholder="Find a workspace section..."
  items={COMMAND_GROUPS}
  onSelect={(item) => setSection(item.value)}
/>
```

By default, selecting an enabled item also calls `onClose`. The palette never hides itself: use
`onClose` to close the surrounding Dialog or BaseDialog. Set `closable` to show a close button that calls
`onClose`. The search input takes focus on mount unless the palette sits inside an element with
`role="dialog"`; set `autofocus={false}` to disable it. Control the query with `searchValue` and
`onSearchValueChange`, or start from `defaultSearchValue`.

### Custom item layout and states

Use `itemRender` when a row needs extra fields such as owner or status; it replaces the default row
content, so the items' `leadingRender` and `trailingRender` no longer apply. Provide `emptyRender`
when an empty query or a miss needs explanation, and `footerRender` for a footer such as keyboard
hints. Set `loading` while results are still arriving: it swaps the leading icon for `loadingIcon`,
and items stay selectable.

```tsx
<CommandPalette
  items={groups}
  itemRender={(ctx) => <span>{ctx.item.label}</span>}
  emptyRender={() => <p>No commands found.</p>}
  loading={isLoading()}
/>
```

Sub-navigation is a short, deliberate branch of commands. Swap the `items` prop from application
state rather than treating the palette as an application shell. Set `closeOnSelect={false}` while
the branch stays open.

### Keyboard interaction

| Key                  | Description                              |
| -------------------- | ---------------------------------------- |
| <kbd>ArrowDown</kbd> | Highlights the next enabled command.     |
| <kbd>ArrowUp</kbd>   | Highlights the previous enabled command. |
| <kbd>Enter</kbd>     | Selects the highlighted command.         |

Focus stays in the search input while the highlight moves. Navigation wraps from the last command to
the first. Escape and other dismissal keys belong to the enclosing Dialog or BaseDialog, not the
palette.

## Examples

### Jump to a workspace section

Filter grouped destinations and store the selected section in page state.

```tsx
import { CommandPalette, Icon } from 'moraine'
import type { CommandPaletteT } from 'moraine'
import { createSignal } from 'solid-js'

const COMMAND_GROUPS: CommandPaletteT.Group[] = [
  {
    type: 'group',
    label: 'Workspace sections',
    items: [
      {
        value: 'overview',
        label: 'Overview',
        description: 'Recent activity and open work',
        leadingRender: () => <Icon name="i-lucide:layout-dashboard" />,
      },
      {
        value: 'members',
        label: 'Members',
        description: 'People with workspace access',
        leadingRender: () => <Icon name="i-lucide:users" />,
      },
      {
        value: 'security',
        label: 'Security',
        description: 'Sign-in and access policies',
        leadingRender: () => <Icon name="i-lucide:shield-check" />,
      },
    ],
  },
]

export function GroupsFiltering() {
  const [section, setSection] = createSignal('overview')

  return (
    <div class="max-w-md w-full space-y-3">
      <CommandPalette
        autofocus={false}
        placeholder="Find a workspace section..."
        items={COMMAND_GROUPS}
        onSelect={(item) => setSection(item.value)}
      />
      <p class="text-sm">Current section: {section()}</p>
    </div>
  )
}
```

### Scan projects by owner and status

Render each command row with extra fields. Keep matching against the item model.

```tsx
import { Badge, CommandPalette, Icon } from 'moraine'
import type { CommandPaletteT } from 'moraine'

interface TeamCommand extends CommandPaletteT.Item {
  owner: string
  status: 'ready' | 'blocked'
}

const GROUPS: CommandPaletteT.Group<TeamCommand>[] = [
  {
    type: 'group',
    label: 'Projects',
    items: [
      {
        value: 'moraine-docs',
        label: 'Moraine Docs',
        description: 'Update examples for the next release',
        owner: 'Design Systems',
        status: 'ready',
      },
      {
        value: 'billing-api',
        label: 'Billing API',
        description: 'Waiting on staging credentials',
        owner: 'Platform',
        status: 'blocked',
      },
    ],
  },
]

export function CustomItemRender() {
  return (
    <div class="max-w-full w-lg">
      <CommandPalette<TeamCommand>
        items={GROUPS}
        autofocus={false}
        itemRender={(ctx) => (
          <div class="flex flex-1 gap-3 min-w-0 items-center">
            <Icon name="i-lucide-folder-kanban text-muted-foreground group-data-[highlighted]:text-accent-foreground shrink-0" />
            <span class="flex flex-1 flex-col min-w-0">
              <span class="text-sm font-medium truncate">{ctx.item.label}</span>
              <span class="text-xs text-muted-foreground truncate group-data-[highlighted]:text-accent-foreground">
                {ctx.item.owner} · {ctx.item.description}
              </span>
            </span>
            <Badge variant={ctx.item.status === 'ready' ? 'soft' : 'outline'}>
              {ctx.item.status}
            </Badge>
          </div>
        )}
      />
    </div>
  )
}
```

### Explain a failed search

Replace the default empty copy when the query matches nothing.

```tsx
import { CommandPalette, Icon } from 'moraine'

export function CustomEmptyState() {
  return (
    <div class="max-w-full w-lg">
      <CommandPalette
        items={[]}
        autofocus={false}
        emptyRender={() => (
          <span class="flex flex-col gap-2 items-center">
            <Icon name="i-lucide-search-x" class="text-xl text-muted-foreground" />
            <span class="text-foreground font-medium">No commands found</span>
            <span class="text-xs">Try a different keyword or clear the search.</span>
          </span>
        )}
      />
    </div>
  )
}
```

### Empty palette copy

Show an empty collection with an explicit no-results message.

```tsx
import { CommandPalette } from 'moraine'

export function CustomStates() {
  return (
    <div class="b-1 b-border rounded-xl max-w-md w-full shadow-lg overflow-hidden">
      <CommandPalette
        autofocus={false}
        placeholder="Search empty query..."
        items={[]}
        emptyRender={() => (
          <p class="text-xs text-muted-foreground p-6 text-center">
            No commands found matching your query.
          </p>
        )}
      />
    </div>
  )
}
```

### Wait for command results

Keep the palette visible while `loading` is true.

```tsx
import { CommandPalette, Icon, KbdGroup } from 'moraine'
import type { CommandPaletteT } from 'moraine'

export function Loading() {
  const BASIC_GROUPS: CommandPaletteT.Group[] = [
    {
      type: 'group',
      label: 'Workspace',
      items: [
        {
          value: 'new-issue',
          label: 'New Issue',
          leadingRender: () => <Icon name="i-lucide-circle-plus" />,
          trailingRender: () => <KbdGroup items={['⌘', 'N']} />,
        },
        {
          value: 'open-inbox',
          label: 'Open Inbox',
          leadingRender: () => <Icon name="i-lucide-inbox" />,
          trailingRender: () => <KbdGroup items={['⌘', 'I']} />,
        },
        {
          value: 'sync-roadmap',
          label: 'Sync Roadmap',
          leadingRender: () => <Icon name="i-lucide-refresh-cw" />,
          description: 'Pull the latest planning updates',
        },
      ],
    },
  ]

  return (
    <div class="max-w-full w-lg">
      <CommandPalette items={BASIC_GROUPS} autofocus={false} loading />
    </div>
  )
}
```

### Search ten thousand commands

Pass a `virtualizer` from `createListVirtualizer` to render only the rows near the viewport. Its
entries are `CommandPaletteT.VirtualEntry` rows: group labels and commands flattened into one list.
The listbox keeps its default bounded height, so the virtual range stays stable while scrolling.

```tsx
import { CommandPalette } from 'moraine'
import type { CommandPaletteT } from 'moraine'
import { createListVirtualizer } from 'moraine/virtualizer'

const GROUPS: CommandPaletteT.Group[] = ['Files', 'Symbols'].map((label) => ({
  type: 'group',
  label,
  items: Array.from({ length: 5_000 }, (_, index) => ({
    value: `${label.toLowerCase()}-${index}`,
    label: `${label.slice(0, -1)} ${index + 1}`,
  })),
}))

export function Virtualization() {
  const virtualizer = createListVirtualizer<CommandPaletteT.VirtualEntry>({
    estimateSize: (entry) => (entry.type === 'label' ? 24 : 32),
    getItemKey: (entry) => entry.key,
    overscan: 8,
  })

  return (
    <div class="max-w-md w-full">
      <CommandPalette
        autofocus={false}
        placeholder="Search 10,000 commands..."
        items={GROUPS}
        virtualizer={virtualizer}
        classes={{ listbox: 'h-72' }}
      />
    </div>
  )
}
```

### Drill into Create or Share

Swap `items` to open a short command branch. Keep selection from closing the palette until the
user finishes or goes back.

```tsx
import { Button, CommandPalette, Icon } from 'moraine'
import type { CommandPaletteT } from 'moraine'
import { createMemo, createSignal } from 'solid-js'

export function SubNavigation() {
  const ROOT_GROUPS: CommandPaletteT.Group[] = [
    {
      type: 'group',
      label: 'Commands',
      items: [
        {
          value: 'create',
          label: 'Create',
          leadingRender: () => <Icon name="i-lucide-plus-circle" />,
          description: 'Create new resources',
        },
        {
          value: 'share',
          label: 'Share',
          leadingRender: () => <Icon name="i-lucide-share-2" />,
          description: 'Share with others',
        },
        {
          value: 'delete',
          label: 'Delete',
          leadingRender: () => <Icon name="i-lucide-trash-2" />,
        },
      ],
    },
  ]
  const CREATE_GROUPS: CommandPaletteT.Group[] = [
    {
      type: 'group',
      label: 'Create',
      items: [
        {
          value: 'create-new-file',
          label: 'New File',
          leadingRender: () => <Icon name="i-lucide-file-plus" />,
        },
        {
          value: 'create-new-folder',
          label: 'New Folder',
          leadingRender: () => <Icon name="i-lucide-folder-plus" />,
        },
        {
          value: 'create-new-project',
          label: 'New Project',
          leadingRender: () => <Icon name="i-lucide-git-branch" />,
        },
      ],
    },
  ]
  const SHARE_GROUPS: CommandPaletteT.Group[] = [
    {
      type: 'group',
      label: 'Share',
      items: [
        {
          value: 'share-copy-link',
          label: 'Copy Link',
          leadingRender: () => <Icon name="i-lucide-link" />,
          trailingRender: () => <span class="text-xs text-muted-foreground">⌘L</span>,
        },
        {
          value: 'share-send-email',
          label: 'Send via Email',
          leadingRender: () => <Icon name="i-lucide-mail" />,
        },
      ],
    },
  ]
  const [view, setView] = createSignal<'root' | 'create' | 'share'>('root')

  const groups = createMemo(() => {
    switch (view()) {
      case 'create':
        return CREATE_GROUPS
      case 'share':
        return SHARE_GROUPS
      case 'root':
      default:
        return ROOT_GROUPS
    }
  })

  const onSelect = (item: CommandPaletteT.Item) => {
    if (item.value === 'create') {
      setView('create')
    } else if (item.value === 'share') {
      setView('share')
    }
  }

  return (
    <div class="flex flex-col gap-3 max-w-full w-lg">
      <div class="flex gap-3 items-center justify-between">
        <p class="text-sm text-muted-foreground">
          Drive multi-step navigation outside the component by swapping the `items` prop.
        </p>
        <Button
          size="sm"
          variant="outline"
          disabled={view() === 'root'}
          onClick={() => setView('root')}
        >
          Back
        </Button>
      </div>
      <CommandPalette
        items={groups()}
        autofocus={false}
        closeOnSelect={false}
        onSelect={onSelect}
      />
    </div>
  )
}
```

## API Reference

### Attributes

| Attributes | Slot | Description |
| --- | --- | --- |
| `data-disabled` | `command-palette-item` | Present when the component, slot, or item is disabled. |
| `data-highlighted` | `command-palette-item`, `command-palette-item-leading`, `command-palette-item-description`, `command-palette-item-trailing` | Present when the item is highlighted by pointer or keyboard navigation. |
| `data-loading` | `command-palette-input-leading` | Present when the component or async operation is loading. |

### Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| autofocus | boolean \| undefined | true | Whether to focus the search input when the palette mounts. Skipped when the palette is<br>inside an element with `role="dialog"`, which handles its own initial focus. |
| closable | boolean \| undefined | false | Whether to show a close button in the header. Clicking it calls `onClose`. |
| closeIcon | IconT.Name \| undefined | 'icon-close' | Icon name for the palette close button. |
| closeOnSelect | boolean \| undefined | true | Whether selecting an enabled item calls `onClose` after `onSelect`. The palette does not<br>close itself. |
| defaultSearchValue | string \| undefined | "" | Initial search text when uncontrolled. |
| descriptionPosition | 'bottom' \| 'trailing' \| undefined | 'bottom' | Where descriptions render in each command item. |
| emptyRender | JSX.Element \| Component<EmptyRenderProps<TItem>> \| undefined | — | Content or render function shown instead of the listbox rows when no item is visible<br>(no groups, or none matches the search). The default is the localized `empty` message.<br>A function receives the search text and loading state. |
| filterMethod | false \| 'contains' \| 'startsWith' \| 'endsWith' \| ((query: string, item: TItem) => boolean) \| undefined | 'contains' | Filtering strategy applied to the trimmed search text. The built-in strategies match the<br>item's search text (see `getItemLabel`) ignoring case and accents, using the active<br>locale. A predicate receives the trimmed query and the item, and returns whether to<br>keep it; it is not called for an empty query. `false` disables filtering, for example<br>when you filter `items` yourself. Items with `alwaysShow` stay visible. |
| footerRender | JSX.Element \| Component<FooterRenderProps<TItem>> \| undefined | — | Content or render function for a footer below the list, such as keyboard hints. Nothing is<br>rendered when unset. A function receives the search text, loading state, and the groups. |
| getItemLabel | ((item: TItem) => string) \| undefined | — | Plain-text label of an item, used only by the built-in filter (`filterMethod` strings);<br>it does not change rendered labels. Replaces the default, which is the label, value,<br>description, and keywords joined by spaces. |
| inputProps | InputElementProps \| undefined | — | Additional attributes for the search `<input>`. Its `onInput` and `onKeyDown` handlers run<br>before the built-in ones, and calling `event.preventDefault()` in them skips the built-in<br>behavior. `value`, `role`, and the combobox `aria-*` wiring are managed by the palette;<br>`aria-label` or `aria-labelledby` replace the placeholder as the accessible name. |
| inputRef | Ref<HTMLInputElement> \| undefined | — | Ref forwarded to the inner search `<input>` element. |
| itemProps | ((context: ItemRenderProps<TItem>) => ElementProps<HTMLDivElement> \| undefined) \| undefined | — | Function returning additional attributes for a command row (the `option` element). It is<br>called per row with the row state. Event handlers run before the built-in ones, and<br>calling `event.preventDefault()` in them skips the built-in behavior. `id`, `role`, and<br>`aria-selected` are managed by the palette. |
| itemRender | Component<ItemRenderProps<TItem>> \| undefined | — | Renders the content of every command row instead of the default leading, label,<br>description, and trailing layout (the items' `leadingRender` and `trailingRender` are then<br>ignored). The row element itself, with its `option` role, highlight, and click handling,<br>stays. Receives the item, its group, and `highlighted`/`disabled` state. |
| items | ({<br>  /** Identifier of the item, unique across all groups. It is also the displayed label when<br>`label` is empty and part of the default search text. Duplicates still render but log a<br>warning in development. */<br>  value: string;<br>  /** Primary label shown for the item. Falls back to `value`. */<br>  label?: string;<br>  /** Secondary text shown for the item, below or after the label depending on the<br>`descriptionPosition` variant. Part of the default search text. */<br>  description?: string;<br>  /** Extra search terms that are not displayed, such as synonyms. They are matched by the<br>built-in filter only; ignored when `getItemLabel` is set or `filterMethod` is a function. */<br>  keywords?: string[];<br>  /** Content or render function shown before the label, such as an icon. Receives the row state.<br>Ignored when the palette sets `itemRender`. */<br>  leadingRender?: JSX.Element \| Component<ItemRenderProps>;<br>  /** Content or render function shown at the end of the row, such as a shortcut hint. Receives<br>the row state. Ignored when the palette sets `itemRender`. */<br>  trailingRender?: JSX.Element \| Component<ItemRenderProps>;<br>  /** Whether the item is disabled: it cannot be selected and keyboard navigation skips it. It is<br>still displayed and marked `aria-disabled`. */<br>  disabled?: boolean;<br>  /** Keeps the item visible while the search text filters the list, even when it does not<br>match, for entries like "Search the docs for...". */<br>  alwaysShow?: boolean;<br>  /** Called, without arguments, when the item is selected by click or Enter. It runs before the<br>palette's `onSelect` and `onClose`. Not called for disabled items. */<br>  onSelect?: () => void;<br>} \| {<br>  /** Marks the entry as a group of items. */<br>  type: 'group';<br>  /** Header shown above the group's items. Without it the items render with no header. */<br>  label?: string;<br>  /** Items in this group. While searching, a group with no matching items is hidden. */<br>  items?: ({<br>    /** Identifier of the item, unique across all groups. It is also the displayed label when<br>  `label` is empty and part of the default search text. Duplicates still render but log a<br>  warning in development. */<br>    value: string;<br>    /** Primary label shown for the item. Falls back to `value`. */<br>    label?: string;<br>    /** Secondary text shown for the item, below or after the label depending on the<br>  `descriptionPosition` variant. Part of the default search text. */<br>    description?: string;<br>    /** Extra search terms that are not displayed, such as synonyms. They are matched by the<br>  built-in filter only; ignored when `getItemLabel` is set or `filterMethod` is a function. */<br>    keywords?: string[];<br>    /** Content or render function shown before the label, such as an icon. Receives the row state.<br>  Ignored when the palette sets `itemRender`. */<br>    leadingRender?: JSX.Element \| Component<ItemRenderProps>;<br>    /** Content or render function shown at the end of the row, such as a shortcut hint. Receives<br>  the row state. Ignored when the palette sets `itemRender`. */<br>    trailingRender?: JSX.Element \| Component<ItemRenderProps>;<br>    /** Whether the item is disabled: it cannot be selected and keyboard navigation skips it. It is<br>  still displayed and marked `aria-disabled`. */<br>    disabled?: boolean;<br>    /** Keeps the item visible while the search text filters the list, even when it does not<br>  match, for entries like "Search the docs for...". */<br>    alwaysShow?: boolean;<br>    /** Called, without arguments, when the item is selected by click or Enter. It runs before the<br>  palette's `onSelect` and `onClose`. Not called for disabled items. */<br>    onSelect?: () => void;<br>  })[];<br>})[] \| undefined | [] | Commands to display, in order: command objects and `{ type: 'group', label, items }` groups.<br>Consecutive commands outside a group render together without a header. The search text<br>filters them according to `filterMethod`; the list is reactive to changes of this prop. |
| leading | IconT.Name \| undefined | 'icon-search' | Icon name of input's leading icon. Replaced by `loadingIcon` while `loading` is `true`. |
| listboxProps | Omit<ElementProps<HTMLDivElement>, 'children'> \| undefined | — | Additional attributes for the command listbox element. Its `id` and `role` are managed by<br>the palette; `class` and `style` are merged with the slot styling. |
| loading | boolean \| undefined | false | Whether the palette is loading, for example while `items` are fetched. Swaps the leading<br>icon for `loadingIcon`; items stay visible and selectable. |
| loadingIcon | IconT.Name \| undefined | 'icon-loading' | Icon shown in place of `leading` while `loading` is `true`; the icon is marked<br>`aria-busy`. |
| onClose | (() => void) \| undefined | — | Called when the close button is clicked, and after an enabled item is selected when<br>`closeOnSelect` is `true`. The palette does not hide itself: use it to close the<br>surrounding `Dialog`, `BaseDialog`, or your own container. Escape is not handled here. |
| onSearchValueChange | ((value: string) => void) \| undefined | — | Called with the new search text when the user edits the input. While an IME composition<br>is in progress it is deferred until the composition ends (except on Android). It is not called when<br>`searchValue` changes from outside. |
| onSelect | ((item: TItem) => void) \| undefined | — | Called with the selected item when the user clicks an enabled item or presses Enter on the<br>highlighted one. It runs after the item's own `onSelect`, and before `onClose` when<br>`closeOnSelect` is `true`. |
| placeholder | string \| undefined | — | Placeholder text for the search input. It is also the input's accessible name unless<br>`inputProps` sets `aria-label` or `aria-labelledby`.<br>Localized via MoraineProvider messages. English default is `Search...`. |
| ref | Ref<HTMLDivElement> \| undefined | — | Ref forwarded to the root `<div>` element. |
| searchMaxLength | number \| undefined | — | Maximum number of characters the search input accepts (the native `maxlength`). |
| searchValue | string \| undefined | — | Search text (controlled). Leave it `undefined` for uncontrolled state and update it from<br>`onSearchValueChange`. Surrounding whitespace is ignored when filtering. |
| translations | Translations \| undefined | — | Overrides for this instance's built-in texts (`placeholder`, `close`, `empty`), merged over<br>the messages from `MoraineProvider`. The `placeholder` prop takes precedence over the<br>`placeholder` translation. |
| virtualizer | Virtualizer<TItem> \| undefined | — | Renders only the visible rows of the flattened group labels and commands. The listbox is<br>the scroll container, and keyboard highlight scrolls through the virtualizer. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| classes | Classes \| undefined | — | Family slot class defaults for this instance. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |
| styles | Styles \| undefined | — | Family slot style defaults for this instance. |

**`emptyRender` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[]}
  emptyRender={(state) => <p>No command matches "{state.searchValue}".</p>}
/>
```

**`filterMethod` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[{ value: 'open-file', label: 'Open file' }]}
  filterMethod={(query, item) =>
    item.value.split('-').some((part) => part.startsWith(query.toLowerCase()))
  }
/>
```

**`footerRender` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[]}
  footerRender={(state) => <span>{state.visibleGroups.length} groups shown</span>}
/>
```

**`getItemLabel` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[{ value: 'open', label: 'Open', keywords: ['launch'] }]}
  getItemLabel={(item) => `${item.label ?? ''} ${item.keywords?.join(' ') ?? ''}`}
/>
```

**`itemProps` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[{ value: 'open', description: 'Open a file' }]}
  itemProps={(row) => ({ title: row.item.description })}
/>
```

**`itemRender` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[{ value: 'open', label: 'Open' }]}
  itemRender={(row) => (
    <strong>{row.highlighted ? '> ' : ''}{row.item.label ?? row.item.value}</strong>
  )}
/>
```

**`items` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  items={[
    { value: 'home', label: 'Home' },
    {
      type: 'group',
      label: 'File',
      items: [
        { value: 'new', label: 'New file', keywords: ['create'], onSelect: () => {} },
        { value: 'save', label: 'Save', description: 'Write to disk', disabled: true },
      ],
    },
  ]}
/>
```

**`translations` example**

```tsx
import { CommandPalette } from 'moraine'

<CommandPalette
  closable
  items={[]}
  translations={{ placeholder: 'Type a command...', empty: 'Nothing found.', close: 'Dismiss' }}
/>
```
