Closed, it's a short pearl field that steps down through satin rings into a round eyepiece. Click it, or press / or ⌘K, and the long tube slides out first, then the collar rings knock into place one after the other with a quiet click. Type, and the results slide down from under the tube.
npx shadcn@latest add https://clickworks.dev/r/telescope-search.jsonThe files land in components/clickworks/telescope-search/. No other packages are added.
import { TelescopeSearch } from "@/components/clickworks/telescope-search/react/TelescopeSearch"
export function HeaderSearch() {
return (
<TelescopeSearch
items={[
{ label: "Pricing", href: "/pricing", description: "Three fixed packages", keywords: "cost rates" },
{ label: "About", href: "/about", description: "Who builds your site" },
{ label: "Contact", href: "/contact", description: "Reply within a day" },
]}
/>
)
}The pages people can find. Keywords are matched but never shown.
Text on the closed field.
Default "Search"
Placeholder once it's open.
Default "Search pages"
A light or a graphite telescope. Auto follows the page, then the device. Your --ts-* properties still win.
Key hint on the closed field. An empty string hides it.
Default "/"
/ and ⌘K (Ctrl+K) open it.
Default true
Which way it pulls out. Left suits a field on the right of the nav.
Default "left"
Open length in px. Shortens itself on narrow screens.
Default 420
Most results shown at once.
Default 5
The count on the field: one, many and none.
Default "{n} page|{n} pages|none"
Shown when nothing matches.
Default "No page matches “{q}”"
A short click when a tube hits its stop.
Default true
A tiny vibration on phones when a tube hits its stop.
Default true
Controlled open state.
A page was picked. Return false to stop navigation, for client-side routing.
The search opened or closed.
The query changed.
Set these custom properties on the component or any parent. Every shade and shadow is mixed from them, so any palette still looks lit.