Seek Search, animated React component
- Pro
- Inputs & Controls
- Spring
A round search button that opens into a field as one object: the pill springs wider while the magnifier turns, and a list of local suggestions drops in underneath and filters as you type. Escape, or leaving it empty, folds it back.
Taps when you pick a suggestion. Sound is off on this site until you switch it on. Types with a key click for every character, in sync with the text. The click stays off until you switch it on.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| suggestions | string[] | ["Quarterly report", "Design review notes", …] | Local suggestions shown under the field and filtered as you type. Nothing is fetched. |
| placeholder | string | "Search files" | Placeholder and accessible name of the field. |
| maxLength | number | 64 | Longest query the field accepts; the query is trimmed before filtering. |
| onSelect | (suggestion: string) => void | undefined | Called with a suggestion when it is clicked. |
| autoplay | boolean | false | Opens, types a word, clears and folds back on a loop until the user interacts. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Seek Search is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Seek Search works
Search that opens as one object. The magnifier slides from the middle of suggestions drop in underneath and filter as you type. Escape, or clicking away when it's empty, folds it back.
The source, the install command and the build prompt come with Pro.
Seek Search questions
How do I install Seek Search?
Run `npx shadcn@latest add @nexus-labs/seek-search`. It installs framer-motion. Seek Search is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I set the suggestions and react to a click?
Pass `suggestions` as an array of strings. They are filtered in the browser as the user types (case-insensitive match, with the matched text in bold) and nothing is fetched. `onSelect` receives the suggestion that was clicked.
How do I close it from the keyboard?
Press Escape to fold it back and clear the query. Clicking away also folds it, but only when the field is empty; with text in it, it stays open. The closed button has `aria-expanded` set.
Which props change the field itself?
`placeholder` (default "Search files") is also the field's accessible name, and `maxLength` (default 64) caps how many characters the query can hold. The pill is 300px wide when open.
Does it make sound, and how do I turn it off?
Taps when you pick a suggestion. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.
