Sections
Getting Started
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)
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
valueprop - Also matches against
keywordsarray - Case-insensitive matching
Highlight Detection
Emits highlight event when item is highlighted (hovered or keyboard navigated).
API Reference
CommandMenuItem
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | (Required) | The searchable value for this item |
keywords | string[] | undefined | Additional keywords for search matching |
class | HTMLAttributes["class"] | undefined | Custom CSS classes |
Events
| Event | Description |
|---|---|
select | Emitted when item is selected |
highlight | Emitted when item is highlighted (hover/keyboard) |
Integration
This component is typically used within CommandMenu and works with the command menu's filter state.