---
title: "Slash Command"
description: "An inline /command with its subcommand path and typed options, including the focused one."
---

An inline /command with its subcommand path and typed options, including the focused one. Compose it from the exported registry parts so local content and behaviour stay in the application while the visual contract stays token-driven.

_Live example of Slash Command — see the page for the rendered demo._

## Installation

```bash
npx newtui@latest add slash-command
```

Files written — React: components/ui/slash-command.tsx. Vue: components/ui/slash-command/SlashCommand.vue, components/ui/slash-command/index.ts.

## Usage

React:

```tsx
import { SlashCommand } from "@/components/ui/slash-command"
```

Vue:

```ts
import { SlashCommand } from "@/components/ui/slash-command"
```

## API reference

**`SlashCommand`**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` | — | Command name rendered after the leading slash. |
| `subcommand` | `string \| undefined` | — | Subcommand segment, e.g. `/ban member`. |
| `subcommandGroup` | `string \| undefined` | — | Subcommand group segment, e.g. `/settings roles add`. |
| `options` | `readonly SlashCommandOption[] \| undefined` | — | Optional options value. |

The registry exports `SlashCommandOption`, `SlashCommand`. Parts without a table accept the native attributes for the element they render; React uses `className`, while Vue uses `class` and fallthrough attributes.

## Accessibility

Preserve the native semantics of the rendered elements and pass through ARIA attributes when the surrounding context needs a label or description. Any interactive child needs a visible focus indicator, and meaning must not rely on colour alone.

## Tokens

Slash Command reads its colours, radii and motion from the `--newt-*` tokens. Override a token rather than editing the component.
