# SlashCommandMenu

Find and run your app’s slash commands from the keyboard.

- **Use it for**: Running your app’s commands from the composer with "/".
- **Not for**: Referencing files or people. Try [MentionPicker](https://unseenui.com/components/mention-picker/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { SlashCommandMenu } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<SlashCommandMenu variant="list" items={commands} query={query} onQueryChange={setQuery} onSelect={invokeCommand} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `className` | `string` | Added to the root element, after the component's own classes. |
| `disabled` | `boolean` |  |
| `error` | `string` |  |
| `items` (required) | `readonly CommandOption[]` |  |
| `onQueryChange` (required) | `(query: string) => void` |  |
| `onSelect` (required) | `(item: CommandOption) => void` |  |
| `query` (required) | `string` |  |
| `status` | `"unknown" \| "ready" \| "loading" \| "denied" \| "error" \| "stale"` |  |
| `variant` | `"list" \| "cards" \| "compact"` |  |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[Reasoning](https://unseenui.com/components/reasoning/), [SuggestTextarea](https://unseenui.com/components/suggest-textarea/), [Checkpoint](https://unseenui.com/components/checkpoint/), [ThreadList](https://unseenui.com/components/thread-list/), [BranchSwitcher](https://unseenui.com/components/branch-switcher/), [MessageQueue](https://unseenui.com/components/message-queue/), [PromptInput](https://unseenui.com/components/prompt-input/), [Message](https://unseenui.com/components/message/), [MessageActions](https://unseenui.com/components/message-actions/), [StreamingResponse](https://unseenui.com/components/streaming-response/), [Suggestions](https://unseenui.com/components/suggestions/), [FollowUps](https://unseenui.com/components/follow-ups/)

Page: https://unseenui.com/components/slash-command-menu/
