Skip to content

CommandPalette ​

Command palette with overlay, live filtering and keyboard navigation, ideal for Cmd+K / Ctrl+K shortcuts.

CommandPalette

Design lines ​

vue
1<script setup>2import { ref } from 'vue'34const openRubik = ref(false)5const paletteCommands = [6  { id: 'open', label: 'Open File', description: 'Open a file' },7  { id: 'save', label: 'Save File', description: 'Save changes' },8]9function onSelect(id) {10  console.log('selected', id)11}12</script>1314<Button @click="openRubik = true">Open palette (rubik)</Button>15<CommandPalette v-model="openRubik" :commands="paletteCommands" design="rubik" @select="onSelect" />

Demo ​

Basic (commands + modelValue) ​

A working palette: pass commands and bind modelValue.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { CommandPalette } from '@dowardev/herdrate-vue'45const open = ref(false)6const commands = [7  { id: 'open', label: 'Open File', description: 'Open a file' },8  { id: 'save', label: 'Save File', description: 'Save changes' },9  { id: 'close', label: 'Close', description: 'Close tab' },10]1112function onSelect(id: string) {13  console.log('selected', id)14}15</script>1617<template>18  <button @click="open = true">Open palette</button>19  <CommandPalette20    v-model="open"21    :commands="commands"22    placeholder="Type a command..."23    @select="onSelect"24  />25</template>

Color (color) ​

Each button opens a working palette: compare the prompt (>) and highlight in both colors.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, CommandPalette } from '@dowardev/herdrate-vue'45const openColorPrimary = ref(false)6const openColorSuccess = ref(false)7</script>89<template>10  <div style="display: flex; gap: 0.5rem;">11    <Button @click="openColorPrimary = true" color="primary">Open primary</Button>1213    <Button @click="openColorSuccess = true" color="success">Open success</Button>14  </div>1516  <CommandPalette v-model="openColorPrimary" :commands="commands" color="primary" @select="onSelect" />1718  <CommandPalette v-model="openColorSuccess" :commands="commands" color="success" @select="onSelect" />19</template>

Props ​

commands ​

List of available commands to filter and select.

TypeDefaultRequired
Array<{id, label, description?, icon?}>[]❌

Each command has this shape:

FieldTypeRequiredDescription
idstring✅Unique identifier
labelstring✅Visible text
descriptionstring❌Optional description
iconstring❌Icon or emoji

modelValue ​

Controls opening (true) and closing (false) of the palette.

TypeDefaultRequired
booleanfalse❌

color ​

Color of the prompt (>) and of the highlighted item.

TypeDefaultRequired
'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark''primary'❌

placeholder ​

Placeholder of the search input.

TypeDefaultRequired
string'Type a command...'❌

design ​

Design line (or inherit from data-design).

TypeDefaultRequired
'tuix' | 'rubik'— (inherits from data-design)❌

Events ​

EventPayloadDescription
update:modelValuebooleanEmitted on open/close
selectstringEmitted when a command is selected (returns id)

CSS Custom Properties ​

TokenDefaultDescription
--font-mono"JetBrains Mono", ui-monospace, monospaceMonospace font stack for code-like content (key labels, log lines, chips).
--accentfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Accent color, mapped from the active semantic color.
--bgfrom theme (--ctp-latte-base / --ctp-mocha-base)Base background of the surface.
--bg-altfrom theme (--ctp-latte-mantle / --ctp-mocha-mantle)Alternate background (the next layer down from the base).
--bg-panelfrom theme (--ctp-latte-surface1 / --ctp-mocha-surface1)Background of panel-like raised surfaces (cards, accordions).
--borderfrom theme (--ctp-latte-surface0 / --ctp-mocha-surface0)Outline and divider color for surfaces.
--textfrom theme (--ctp-latte-text / --ctp-mocha-text)Primary text color used inside the component.
--text-mutedfrom theme (--ctp-latte-subtext1 / --ctp-mocha-subtext1)Secondary text for hints, annotations and disabled state.
--color-primaryfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Primary semantic color (mauve in Catppuccin).
--color-secondaryfrom theme (--ctp-latte-lavender / --ctp-mocha-lavender)Secondary semantic color (lavender in Catppuccin).
--color-tertiaryfrom theme (--ctp-latte-blue / --ctp-mocha-blue)Tertiary semantic color (blue in Catppuccin).
--color-successfrom theme (--ctp-latte-green / --ctp-mocha-green)Success semantic color (green in Catppuccin).
--color-warningfrom theme (--ctp-latte-yellow / --ctp-mocha-yellow)Warning semantic color (yellow in Catppuccin).
--color-dangerfrom theme (--ctp-latte-red / --ctp-mocha-red)Danger semantic color (red in Catppuccin).
--color-lightfrom theme (--ctp-latte-surface1 / --ctp-mocha-rosewater)Light semantic color (lighter contrast tone).
--color-mediumfrom theme (--ctp-latte-overlay0 / --ctp-mocha-overlay2)Medium semantic color (mid-tone).
--color-darkfrom theme (--ctp-latte-text / --ctp-mocha-subtext1)Dark semantic color (high contrast text).
--shadownone on TUIX, elevated on rubikElevation shadow for raised surfaces.
--shadow-hovervar(--shadow-hover, var(--shadow))Shadow on hover/active state.

Ver Theming para la convención completa.