Skip to content
/ cmd-bar Public

Performant, unstyled command palette for Vue 3.

License

Notifications You must be signed in to change notification settings

fabkho/cmd-bar

Repository files navigation

cmd-bar wip

Preview

npm version npm downloads License Vue

Features

  • 🎨  Unstyled - No styles included, you can style it as you want
  • 🧩  Extensible - You can add your own Modal and components
  • ⌨️  Key bindings - Usable with just a keyboard
  • 🧙‍  Virtualized - It uses useVirtualList

📖  Read more

Quick Setup

  1. Add cmd-bar dependency to your project
# Using pnpm
pnpm add -D cmd-bar

# Using yarn
yarn add --dev cmd-bar

# Using npm
npm install --save-dev cmd-bar
  1. Then you can import the CmdBar Compound Component in your project.
import { CmdBar } from 'cmd-bar'

<CmdBar :groups="groupedCommands" />
  <CmdBarDialog>
    <template #header>
      <CmdBarInput placeholder="search fo anything />
    </template>
    <template #content>
      <CmdBarList :config="listConfig">
          <template #default="{ command }">
            <div class="leading">
              <img :src="command.leading" alt="icon" />
              {{ command.label }}
            </div>
            <span v-if="command.shortcut" class="actions">
              <kbd v-for="shortcut of formattedShortcuts(command.shortcut)" :key="shortcut">
                {{ shortcut }}
              </kbd>
            </span>
          </template>
      </CmdBarList>
    </template>
  </CmdBarDialog>
</CmdBar>

That's it! ✨

📖  Read more

Props to xiaoluoboding/vue-command-palette and CommandPalette - Nuxt UI, for the inspiration.