#236
DocsSearch
A DocsSearch dialog opened from an Open search button over a two-entry index, showing the selected href afterwards.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "DocsSearch" pattern (@codeatlasdev/ui demo #236, docs-kit/docs) in my app.
Call get_demo({ ids: ["#236"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Docs site search opened by a button or shortcut that jumps to a page or heading.
Keep these library parts, with the props and tokens the demo uses:
- Button, DocsSearch, DocsSearchEntry from "@codeatlasdev/ui"
Behaviour to keep:
- `<Button variant="outlined" onclick={() => (open = true)}>` labelled Open search
- `<DocsSearch bind:open {index} onselect={(href) => (picked = href)} />`
- State: `let open = $state(false)` and `let picked = $state('')`
- `index` typed `DocsSearchEntry[]` has 2 entries (Send text, Webhooks) with `href`, `title`, `section`, `description`, `headings` and `text`
- `<span class="picked" aria-live="polite">` shows Selected plus the chosen href
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- Button
@codeatlasdev/ui - DocsSearch
@codeatlasdev/ui
How it is built
- `<Button variant="outlined" onclick={() => (open = true)}>` labelled Open search
- `<DocsSearch bind:open {index} onselect={(href) => (picked = href)} />`
- State: `let open = $state(false)` and `let picked = $state('')`
- `index` typed `DocsSearchEntry[]` has 2 entries (Send text, Webhooks) with `href`, `title`, `section`, `description`, `headings` and `text`
- `<span class="picked" aria-live="polite">` shows Selected plus the chosen href
Related
Loading source.