Prompt suggestions that answer the pointer. Chips lean toward it; a picked one flies into the input and types itself in while its neighbours are nudged away, nearest first. Any key finishes the typing at once, and Enter sends.
- Starting points above a chat input
- An assistant's empty state
- Quick rewrites of a draft
Examples
Installation
npx knowns-ui@latest add magnet-chipsPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Magnet chips 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/magnet-chips
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 magnet-chips
```
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
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/magnet-chips/magnet-chips.tsx
- components/ui/knowns/magnet-chips/magnet-chips-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/magnet-chips, 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: "magnet-chips" }) 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
- suggestionsrequired
MagnetSuggestion[]- id, label, and optionally prompt (what goes into the input, the label by default) and an icon.
- value / defaultValue / onValueChange
string- Default
"" - The input's text, controlled or not. While a prompt types in, onValueChange gets each step.
- onPick
(s) => void- A chip was picked, called at once before the flight and the typing.
- onSubmit
(text) => void- Enter without Shift, or the send button.
- placeholder / label
string- Default
"Ask anything" / "Message" - The input's placeholder and its name for assistive tech.
- magnet
boolean- Default
true - Chips lean toward a mouse or pen pointer. Never on touch.
- Motion
-- A lean of up to 6px on SPRING.glide; the pick kicks the others away in order of distance (14 to 55ms a step, 240ms in all); the copy flies in MOTION.travel, ease in-out; typing takes 420ms at most; chips press to 0.94. Reduced motion: no lean, push or flight; the prompt is in the input at once.
| Prop | Type | Default | Description |
|---|---|---|---|
| suggestionsrequired | MagnetSuggestion[] | required | id, label, and optionally prompt (what goes into the input, the label by default) and an icon. |
| value / defaultValue / onValueChange | string | "" | The input's text, controlled or not. While a prompt types in, onValueChange gets each step. |
| onPick | (s) => void | - | A chip was picked, called at once before the flight and the typing. |
| onSubmit | (text) => void | - | Enter without Shift, or the send button. |
| placeholder / label | string | "Ask anything" / "Message" | The input's placeholder and its name for assistive tech. |
| magnet | boolean | true | Chips lean toward a mouse or pen pointer. Never on touch. |
| Motion | - | - | A lean of up to 6px on SPRING.glide; the pick kicks the others away in order of distance (14 to 55ms a step, 240ms in all); the copy flies in MOTION.travel, ease in-out; typing takes 420ms at most; chips press to 0.94. Reduced motion: no lean, push or flight; the prompt is in the input at once. |
Accessibility
- The chips are a list of buttons; a pick moves focus to the input and is announced once.
- Typing, a click in the input or Enter finishes the typing at once, so the text is never held back by the animation.
- The input has a label, and the send button is named and disabled while the input is empty.
What it handles
- 01Leans the chips near a mouse or pen pointer a few px toward it, each on its own spring, and never on touch.
- 02Tells you a pick at once through onPick and moves focus to the input before anything moves.
- 03Kicks the other chips away from the pick along their bearing, nearest first, and lets them settle back.
- 04Flies a copy of the chip into the input and types the prompt in, 420ms at most however long it is.
- 05Finishes the typing at once on a key, a click in the input or Enter, so the text is never held back.
- 06Sends with Enter (Shift and Enter for a new line) or the send button, which stays disabled while the input is empty.
States
- First render
- Nothing
- none
- Pointer near
- The near chips lean toward it
- none fixed: a spring (glide) that settles
- Chip pressed
- It dips to 0.94
- 120ms, ease out
- Chip picked
- The others are kicked away nearest first and the copy flies into the input
- 420ms, ease in-out
- Reduced motion
- No lean, push or flight; the prompt is in the input at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing | none |
| Pointer near | The near chips lean toward it | none fixed: a spring (glide) that settles |
| Chip pressed | It dips to 0.94 | 120ms, ease out |
| Chip picked | The others are kicked away nearest first and the copy flies into the input | 420ms, ease in-out |
| Reduced motion | No lean, push or flight; the prompt is in the input at once | 0ms |
Works with
When to use
When to use
- Prompt suggestions above a chat input, where picking one should feel like it lands in the box.
- Empty states of an assistant that offer three to six starting points.
When not to use
- A full input with attachments, model and mode menus: use Chat Composer.
- Inline completions while typing: use Ghost Text.
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 Magnet Chips to my app and wire it to my own data.
- I need prompt suggestions above a chat input, where picking one should feel like it lands in the box. Set that up with the Knowns UI Magnet Chips.
- Which Magnet Chips props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "magnet-chips" }) and search_docs({ query: "magnet chips" }).