Shows what a search finds by searching: sample queries type themselves in turn and the results change with each one. Focus the field and it becomes a real search over every sample result.
On this page
Examples
Results
Installation
npx knowns-ui@latest add typed-search-demoFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Typed search demo from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/typed-search-demo
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add typed-search-demo
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/illustrations/illust-utils.ts
- components/ui/knowns/illustrations/use-in-view.ts
- components/ui/knowns/marquee/marquee.tsx
- components/ui/knowns/marquee/marquee-utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/text-animation/text-core.tsx
- components/ui/knowns/text-animation/typewriter.tsx
- components/ui/knowns/blocks/marketing/typed-search-demo.tsx
- components/ui/knowns/blocks/marketing/typed-search-demo-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/typed-search-demo, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "typed-search-demo" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- queries
{ query, results }[]- Sample queries in the order they are typed, each with what it finds. The first is on show from the first render.
- renderResult
(item, index) => ReactNode- Default
row - Draws one result. The default row has an icon, a title and a meta line.
- resultText / resultKey
(item) => string- Default
title + meta / id - What a typed query matches (every word, as a word start) and a stable key per result.
- label / placeholder
string- Default
"Search" - The field's accessible name, and its placeholder once cleared.
- hold
number- Default
1800 - Ms a typed query holds before it is deleted.
- empty
ReactNode- Shown when a typed query finds nothing.
- onQueryChange
(query, "sample" | "typed") => void- Each query on show, so a later section can carry it on.
- paused
boolean- Default
false - Hold the demo on the current query.
- trailing
ReactNode- Something at the end of the field, such as a shortcut hint.
- resultsClassName
string- Layout of the results: a column of rows by default, or a grid.
| Prop | Type | Default | Description |
|---|---|---|---|
| queries | { query, results }[] | - | Sample queries in the order they are typed, each with what it finds. The first is on show from the first render. |
| renderResult | (item, index) => ReactNode | row | Draws one result. The default row has an icon, a title and a meta line. |
| resultText / resultKey | (item) => string | title + meta / id | What a typed query matches (every word, as a word start) and a stable key per result. |
| label / placeholder | string | "Search" | The field's accessible name, and its placeholder once cleared. |
| hold | number | 1800 | Ms a typed query holds before it is deleted. |
| empty | ReactNode | - | Shown when a typed query finds nothing. |
| onQueryChange | (query, "sample" | "typed") => void | - | Each query on show, so a later section can carry it on. |
| paused | boolean | false | Hold the demo on the current query. |
| trailing | ReactNode | - | Something at the end of the field, such as a shortcut hint. |
| resultsClassName | string | - | Layout of the results: a column of rows by default, or a grid. |
States
- First render
The first query typed, its results shown- nothing plays
- A query lands
Its results rise in, row by row from the first- Default
180ms each, 40ms apart - ease out
- Deleting
The last results stay- -
- Focus or Pause
The demo stops; typing filters every sample result- Default
at once - -
- Off screen, hidden tab
Holds- -
- Reduced motion
The first query and its results, still- -
| Prop | Type | Default | Description |
|---|---|---|---|
| First render | The first query typed, its results shown | - | nothing plays |
| A query lands | Its results rise in, row by row from the first | 180ms each, 40ms apart | ease out |
| Deleting | The last results stay | - | - |
| Focus or Pause | The demo stops; typing filters every sample result | at once | - |
| Off screen, hidden tab | Holds | - | - |
| Reduced motion | The first query and its results, still | - | - |
Accessibility
- A real search field with a label. While the demo runs, it is described as sample searches that stop on focus.
- A visible Pause button while it types (motion over five seconds needs a way to stop it).
- Results are announced politely only once the visitor types, so the demo does not talk over the page.
When to use
When to use
- A landing section that shows what a search finds by searching: sample queries type in turn and the results change.
- A hero whose search a visitor can take over, with the query carried into later sections through onQueryChange.
When not to use
- A real search page with filters and paging: use Search Results.
- A headline whose word changes: use Word Rotate.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Typed Search Demo to my app and wire it to my own data.
- I need a landing section that shows what a search finds by searching: sample queries type in turn and the results change. Set that up with the Knowns UI Typed Search Demo.
- Which Typed Search Demo props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "typed-search-demo" }) and search_docs({ query: "typed search demo" }).