Command
The Command component is used to access items at ease.
1. Import
KUMUI exports 7 Command-related components:
import { CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator } from "@rohitgadekar/kimui";
2. Usage
3. API
3.1 CommandDialog
| Attribute | Type | Description | Default |
|---|---|---|---|
| open | boolean | Determines whether the command dialog is open or not | false |
| onOpenChange | (open: boolean) => void | Callback function when the open state changes | - |
3.2 CommandInput
| Attribute | Type | Description | Default |
|---|---|---|---|
| placeholder | string | Text displayed when the input is empty | "Search..." |
| value | string | The current value of the input field | - |
| onChange | (value: string) => void | Callback triggered when the input value changes | - |
3.3 CommandList
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | React.ReactNode | Children that represent the list of command items | - |
3.4 CommandEmpty
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | React.ReactNode | Text or elements to display when no results are found | No results found. |
3.5 CommandGroup
| Attribute | Type | Description | Default |
|---|---|---|---|
| heading | string | The heading label for the group of commands | - |
| children | React.ReactNode | The list of command items within the group | - |
3.6 CommandItem
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | React.ReactNode | Content of the command item, typically an action label | - |
| shortcut | string | The keyboard shortcut associated with the item (optional) | - |
3.7 CommandSeparator
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | React.ReactNode | Optional children or separator elements | - |