FilterSearchBar
organismsA structured search bar over a small query language: type role:worker cpu>=50 by hand or build it from the schema-driven dropdown, get removable chips and a parsed AST to run anywhere.
Fleet search
bind:value holds the raw query; parse gives the AST that compilePredicate runs in memory and toSql hands to a backend. Click a preset or type role:… by hand.
| Service | Role | Region | CPU % | Status |
|---|---|---|---|---|
| worker-02 | worker | eu-west-1 | 87 | warn |
| cache-01 | cache | us-east-1 | 4 | danger |
| search-index | service | us-east-1 | 55 | warn |
SELECT * FROM services
WHERE status <> 'ok';Sizes, shapes and surfaces
size="sm" | "md" | "lg", shape="pill", surface="raised" | "sunken", font="sans" for a plain search box; grow fills a toolbar row.
States
empty with a placeholder, hotkey="s" with showHotkey, autoQuote off, showChips off, an unknown field kept as free text, and a long query wrapping its chips.
One query, three outputs
onchange(query, raw) fires the AST on every edit; serialize normalises it, toSql compiles it, compilePredicate runs it, filters lists the leaves.
- Normalised
- ∅
- Filters
- ∅
- Matches
- api-gateway, worker-02, cache-01, postgres-primary, media-transcode, search-index
- SQL
- SELECT * FROM services WHERE TRUE;
Props
| Prop | Type | Default | Description |
|---|---|---|---|
schema required | Schema | — | |
value bindable | string | '' | The raw textual query (two-way bindable). |
placeholder | string | 'artist:"Daft Punk" AND year>=2000' | |
showChips | boolean | true | Render the parsed, removable filter chips under the bar. |
autoQuote | boolean | true | When a string field's value step opens (`title:`), auto-insert a `""` pair with the caret inside so multi-word values stay together; Tab exits the quotes. Set false for bare typing where spaces split the value. |
size | ControlSize | 'md' | Forwarded to FilterInput. |
shape | 'square' | 'pill' | 'square' | |
surface | 'base' | 'raised' | 'sunken' | 'base' | |
font | 'mono' | 'sans' | 'mono' | `sans` renders the typed text and placeholder in `--font-sans`; chips stay mono. |
hotkey | string | — | |
showHotkey | boolean | false | |
grow | boolean | false | |
onchange | (query: Query, raw: string) => void | — | Fires the parsed AST on every change — feed this to your backend. |
onsubmit | (value: string) => void | — | Fires on Enter / clear / chip-remove with the raw query string. |
class | string | '' | |
style | string | '' |