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
| Prop | Atributo | Tipo | Default | Descripción |
|---|
activeTab | active-tab | string | '' | The active tab's value (the scope model key), or '' = no active tab. |
async | async | boolean | false | When true, the host supplies already-filtered, ordered items: disable
internal client filtering so fetch-as-you-type results pass through. |
chips | chips | string | '[]' | Facet chips as JSON string: [{label:string, icon?:string}[]] |
emptyMessage | empty-message | string | 'No results found' | Empty state message when no results match |
favorites | favorites | string | '[]' | 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. |
hasMore | has-more | boolean | false | Show the "Más ▾" overflow tab. |
items | items | CommandItem[] | string | [] | Items to display (JSON string or set via JS property) |
loading | loading | boolean | false | Show a loading indicator in the results area (async fetch in flight). |
moreLabel | more-label | string | 'More' | Label for the overflow tab. |
open | open | boolean | false | Whether the command palette is open |
placeholder | placeholder | string | 'Search...' | Placeholder text for the search input |
tabs | tabs | string | '[]' | Module tabs (mac-Spotlight style) as JSON: [{value,label,icon}]. Empty = no tabs row. |
Eventos
| Evento | Detail | Bubbles | Cancelable | Descripción |
|---|
coBackspaceEmpty | string | — | ✓ | Emitted 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. |
coChipRemove | number | — | ✓ | Emitted when the user clicks ✕ on a facet chip.
detail = chip index (number). |
coClose | void | ✓ | ✓ | |
coMoreTabs | void | — | ✓ | Emitted when the "Más ▾" overflow tab is clicked. |
coScopeChange | string | — | ✓ | Emitted when an item with keepOpen=true is selected. Detail = item.value (scope model key). |
coSearch | string | ✓ | ✓ | |
coSelect | string | ✓ | ✓ | |
coTabSelect | string | — | ✓ | Emitted when a module tab is clicked. detail = tab value; '' when the active tab is re-clicked (deselect). |
Slots
| Slot | Descripción |
|---|
trigger | Optional trigger element that opens the palette on click |
CSS Parts
| Part | Descripció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.