Skip to content
tcpsystemsui

Theme

Colour scheme
Accent
Density
Radius
Esc

CommandPalette

Search and commands: Ctrl or Cmd K, combobox over a listbox, items loaded on first open.

beta

Try it

Esc
Svelte
<CommandPalette id="playground-command-palette" placeholder="Search deployments, invoices, or team members" empty="No results found." />

Examples

Quick actions

Esc
Quick actions.svelte
<script lang="ts">
	import Button from '@tcpsystems/ui/foundation/Button';
	import CommandPalette from '@tcpsystems/ui/foundation/CommandPalette';
	const uid = $props.id();
</script>

<Button data-tcp-open={uid}>Open command palette</Button>
<CommandPalette
	id={uid}
	label="Search commands"
	placeholder="Search deployments, invoices, or team members"
	empty="No commands match. Try a deployment name or invoice number."
/>

Custom labels

Esc
Custom labels.svelte
<script lang="ts">
	import Button from '@tcpsystems/ui/foundation/Button';
	import CommandPalette from '@tcpsystems/ui/foundation/CommandPalette';
	const uid = $props.id();
</script>

<Button variant="ghost" icon="search" data-tcp-open={uid}>Find invoice</Button>
<CommandPalette
	id={uid}
	label="Find invoice"
	placeholder="Search by invoice number or customer"
	empty="No invoices found. Try INV-2048 or Acme Labs."
/>

API

Import
import CommandPalette from '@tcpsystems/ui/foundation/CommandPalette';
PropTypeDefault
mode?'palette' | 'dialog' | 'trigger''palette'
id?stringnone
src?stringnone
items?PaletteItem[]none
recentItems?PaletteItem[]none
label?string'Search'
placeholder?string'Search'
empty?string'Nothing matches. Try fewer words, or part of a name.'
results?R[][]
query?string''
shortcut?string'Ctrl K'
HookKind
.tcp-search-triggerRoot class
data-positionData attribute
data-recentData attribute
data-sizeData attribute
data-srcData attribute