Skip to content

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" />
  <CmdBar.Dialog>
    <template #header>
      <CmdBar.Input placeholder="search fo anything />
    </template>
    <template #content>
      <CmdBar.List :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>
      </CmdBar.List>
    </template>
  </CmdBar.Dialog>
</CmdBar>

That's it! ✨

📖  Read more

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