Install
Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):
npx shadcn-vue@latest add https://beehexa.design/r/command.json
This also installs Dialog and Input group.
Use
<script setup lang="ts">
import {
Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList,
} from '@/components/ui/command'
</script>
<template>
<Command>
<CommandInput placeholder="Search pages and actions" />
<CommandList>
<CommandEmpty>Nothing matches.</CommandEmpty>
<CommandGroup heading="Go to">
<CommandItem value="orders">Orders</CommandItem>
<CommandItem value="products">Products</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</template>
Props
| Part | Prop | Values | Notes |
|---|---|---|---|
Command |
v-model |
string or array | The chosen item’s value. Most palettes only use @select |
Command |
multiple |
boolean | Several items can be chosen; each shows a check |
CommandDialog |
open |
boolean | v-model:open |
CommandDialog |
title, description |
string | For screen readers. Set them in the page’s language |
CommandDialog |
showCloseButton |
boolean, default true |
The dialog’s close button |
CommandInput |
placeholder |
string | |
CommandGroup |
heading |
string | |
CommandItem |
value |
string | Required, unique |
CommandItem |
disabled |
boolean | |
CommandItem |
@select |
event | Runs the action |
Built on
The reka-ui Listbox, with the shadcn-vue Command API as control-center uses it, and the Dialog and Input group components. reka-ui gives role="listbox", aria-activedescendant from the search field, and the arrow keys. The filtering is control-center’s, with reka-ui’s useFilter. Beehexa adds the styles.