Skip to content

Magnet Chips

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.

On this page
Used for
  • Starting points above a chat input
  • An assistant's empty state
  • Quick rewrites of a draft

Examples

Installation

npx knowns-ui@latest add magnet-chips
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

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
Defaulttrue
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

  1. 01Leans the chips near a mouse or pen pointer a few px toward it, each on its own spring, and never on touch.
  2. 02Tells you a pick at once through onPick and moves focus to the input before anything moves.
  3. 03Kicks the other chips away from the pick along their bearing, nearest first, and lets them settle back.
  4. 04Flies a copy of the chip into the input and types the prompt in, 420ms at most however long it is.
  5. 05Finishes the typing at once on a key, a click in the input or Enter, so the text is never held back.
  6. 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

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" }).

Need help?

Stuck on Magnet Chips, or found something off? We read every message.