---
title: "Command"
slug: command
category: component
type: examples
version: 20.0.0
tokens: 2056
source: https://ovh.github.io/design-system/v20.0.0/llms/react-components-command--examples.txt
---
# Command
## Default
```tsx
item 1
item 2
No results found.
```
## Controlled
```tsx
{
const [isOpen, setIsOpen] = useState(false);
function onOpenChange({ open }: { open: boolean }) {
setIsOpen(open);
}
function openCommand() {
setIsOpen(true);
}
return (
<>
New file
Open file
Save file
No results found.
>
);
}
```
## Controlled Filtering
```tsx
{
const [query, setQuery] = useState('');
const actions = ['New file', 'Open file', 'Save file'];
const visibleActions = actions.filter((action) => !query || action.toLowerCase().includes(query.toLowerCase()));
return (
setQuery(e.target.value) }
placeholder="Search..."
value={ query }
/>
{ visibleActions.map((action) => (
{ action }
)) }
No results found.
);
}
```
## With Shortcuts
```tsx
New file
⌘+n
Open file
Save file
No results found.
```
## With On Select
```tsx
<>
toast('New file', { toasterId: 'command-on-select' }) }>New file
toast('Open file', { toasterId: 'command-on-select' }) }>Open file
toast('Save file', { toasterId: 'command-on-select' }) }>Save file
No results found.
>
```
## Without Filter
```tsx
New file
Open file
Save file
Undo
Redo
No results found.
```
## Empty State
```tsx
No results found.
```
## Accessibility Labels
```tsx
New file
Open file
Save file
No results found.
```
## Accessibility Filter Label
```tsx
New file
Open file
Save file
No results found.
```
## Accessibility Group Names
```tsx
New file
Open file
Some help
Some more help
No results found.
```
## Accessibility Disabled Option
```tsx
New file
Open file
Save file
Some help
Some more help
No results found.
```