All specs
Interactive · search

search

Interactive fuzzy search/filter over a dataset.

When to use

Use search as a standalone data-filtering component — when you want

the user to find and select from a dataset without the full prompt

anatomy (anchor, label, PromptShell). Think of it as fzf for Caret.

Use prompt.autocomplete when the search is part of a form/prompt flow.

Use search when filtering is the primary interaction.

Anatomy

▸ query█  3/42

· api-gateway        running · us-east-1
· billing-svc        failed · eu-west-1
▸ auth-service       running · us-east-1

type to filter  ↑↓ navigate  ↵ select  esc cancel

API

const service = await search({
  items: services.map(s => ({
    value: s.id,
    label: s.name,
    description: `${s.status} · ${s.region}`,
  })),
  placeholder: 'Search services…',
  limit: 10,
})

if (service) {
  // user selected something
}

### Options

KeyTypeDefaultDescription
itemsarray{ value, label, description? }
placeholderstring?Shown when query is empty
limitnumber?10Max visible results
filterfn?fuzzy match on label+descCustom (query, item) => boolean

### Return value

Returns T | null — the value of the selected item, or null if

the user pressed Esc.

Filter algorithm

Default: case-insensitive subsequence matching across label and

description (concatenated). Same algorithm as prompt.autocomplete.

Visual differences from prompt.autocomplete

Feature`prompt.autocomplete``search`
Anchor (^)YesNo
Tracked CAPS labelYesNo
PromptShellYesNo
Description columnNoYes (per item)
Countermatch countfiltered/total
Prefix/ markers/· prefixes

Keyboard

KeyAction
charsAppend to query, reset cursor to top
BackspaceDelete character
←/→Move input cursor
↑/↓Move selection cursor
Ctrl+UClear query
EnterSelect highlighted item
EscCancel → returns null

Tokens

colors.accent, symbols.prefix.focused, symbols.prefix.idle