Logoshadcn-docs-template
DocsDemo
Sections
  • Get Started
Getting Started
  • Introduction
  • Installation
Customization
  • Customizing the Template
  • MDC Components
  • Composables
  • Writing Documentation
Components
  • DocTabs
  • Callout
  • ComponentPreview
  • CommandMenu
  • CopyButton
  • DocsSidebar
  • DocsTableOfContents
  • PageHeader
  • SiteHeader
  • CopyCodeButton
  • DocsCopyPage
  • CodeBlockCommand
  • CommandMenuItem
  • CommandMenuKbd
  • GitHubLink
  • LucideIcon
  • MainNav
  • MobileNav
  • ModeSwitcher
  • PageHeaderDescription
  • PageHeaderHeading
  • SiteBody
  • SiteConfig
  • SiteFooter
  • OgImage (Custom)

CommandMenuItem

PreviousNext

A menu item component for the command menu with visibility filtering and highlight detection.

The CommandMenuItem component is a specialized menu item for use within the CommandMenu component.

Usage

<script setup lang="ts">
import { CommandMenuItem } from '@/components/CommandMenuItem'
</script>

<template>
  <CommandMenuItem
    value="Search Item"
    :keywords="['search', 'find']"
    @select="handleSelect"
    @highlight="handleHighlight"
  >
    Search Item
  </CommandMenuItem>
</template>

Features

Visibility Filtering

Automatically shows/hides based on search query:

  • Matches against value prop
  • Also matches against keywords array
  • Case-insensitive matching

Highlight Detection

Emits highlight event when item is highlighted (hovered or keyboard navigated).

API Reference

CommandMenuItem

PropTypeDefaultDescription
valuestring(Required)The searchable value for this item
keywordsstring[]undefinedAdditional keywords for search matching
classHTMLAttributes["class"]undefinedCustom CSS classes

Events

EventDescription
selectEmitted when item is selected
highlightEmitted when item is highlighted (hover/keyboard)

Integration

This component is typically used within CommandMenu and works with the command menu's filter state.

CodeBlockCommandCommandMenuKbd

On This Page

UsageFeaturesVisibility FilteringHighlight DetectionAPI ReferenceCommandMenuItemEventsIntegration
© shadcn-vue.com