Ir al contenido

co-command-search

A command palette / search component (⌘K style). Opens as an overlay with a search input and filterable list of items.

Ver código
<co-command-search></co-command-search>

Props

PropAtributoTipoDefaultDescripción
activeTabactive-tabstring''The active tab's value (the scope model key), or '' = no active tab.
asyncasyncbooleanfalseWhen true, the host supplies already-filtered, ordered items: disable internal client filtering so fetch-as-you-type results pass through.
chipschipsstring'[]'Facet chips as JSON string: [{label:string, icon?:string}[]]
emptyMessageempty-messagestring'No results found'Empty state message when no results match
favoritesfavoritesstring'[]'Favorites / shortcuts grid (mac-Spotlight app grid) as JSON: [{value,label,icon,color}]. Shown as a grid at the top of the results, only while the query is empty.
hasMorehas-morebooleanfalseShow the "Más ▾" overflow tab.
itemsitemsCommandItem[] | string[]Items to display (JSON string or set via JS property)
loadingloadingbooleanfalseShow a loading indicator in the results area (async fetch in flight).
moreLabelmore-labelstring'More'Label for the overflow tab.
openopenbooleanfalseWhether the command palette is open
placeholderplaceholderstring'Search...'Placeholder text for the search input
tabstabsstring'[]'Module tabs (mac-Spotlight style) as JSON: [{value,label,icon}]. Empty = no tabs row.

Eventos

EventoDetailBubblesCancelableDescripción
coBackspaceEmptystringEmitted when Backspace is pressed with an empty query, or when the scope chip ✕ is clicked. Detail = current query string (always '' at emit time). Host decides: pop scope or remove last facet.
coChipRemovenumberEmitted when the user clicks ✕ on a facet chip. detail = chip index (number).
coClosevoid
coMoreTabsvoidEmitted when the "Más ▾" overflow tab is clicked.
coScopeChangestringEmitted when an item with keepOpen=true is selected. Detail = item.value (scope model key).
coSearchstring
coSelectstring
coTabSelectstringEmitted when a module tab is clicked. detail = tab value; '' when the active tab is re-clicked (deselect).

Slots

SlotDescripción
triggerOptional trigger element that opens the palette on click

CSS Parts

PartDescripción
::part(favorites)
::part(input)
::part(input-row)
::part(loading)
::part(panel)
::part(results)
::part(tabs)

CSS Custom Properties

Este componente no expone CSS custom properties.