Ask Nexus Input, animated React component
A headline over a pill-shaped question field whose placeholder questions roll past while it is empty. Send a question and the words break into dust that blows off to the right, letter by letter from the end, before the field resets.
- Pro
- AI Components
- Spring
Whooshes when you send a question. 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.
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Ask Nexus UI anything
Press Enter to ask. Empty asks the one showing.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| title | string | "Ask Nexus UI anything" | Headline above the field. |
| placeholders | string[] | 5 questions | Questions that roll through the placeholder. Sending an empty field asks the one showing. |
| placeholderInterval | number | 2800 | Time each placeholder stays up, in ms. |
| defaultValue | string | "" | Text the field starts with. |
| onSubmit | (value: string) => void | — | Called with the trimmed question the moment it is sent. |
| autoplay | boolean | false | Types and sends the placeholders in turn until someone touches the field. |
| className | string | — | Extra classes for the root. |
| 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
Ask Nexus Input 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 Ask Nexus Input works
A headline over a pill-shaped question field. Placeholder questions roll off to the right, letter by letter from the end, before the field resets.
The source, the install command and the build prompt come with Pro.
About Ask Nexus Input
Ask Nexus Input is an AI query field with animated example query cycling and spring expand-on-focus behavior. When idle, the input cycles through example queries with a fade transition. On focus, the field expands with a Framer Motion spring layout animation and reveals a suggestions panel. Designed for AI search interfaces and copilot product demos, it connects to any streaming chat API via standard React event handlers.
Good for
- AI search and query interfaces
- Copilot and assistant product demos
- Natural language command surfaces
- AI product hero section inputs
Ask Nexus Input questions
How do I install the Ask Nexus input?
Run `npx shadcn@latest add @nexus-labs/ask-nexus-input`. It installs framer-motion and lucide-react; the dust effect needs no other library.
How do I get the submitted query?
Pass `onSubmit`. It fires with the trimmed value the moment the user submits, before the animation starts. If the input is empty, the placeholder currently showing is submitted instead.
How do I change the headline and suggestions?
Use `title` for the headline, `placeholders` for the rotating suggestions, and `placeholderInterval` (default 2800 ms) for how often they change.
How is the disintegration effect made?
The submitted text is drawn onto a 2D canvas and broken into particles that peel away from right to left, animated with requestAnimationFrame. There is no WebGL.
Does it make sound, and how do I turn it off?
Whooshes when you send a question. 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.