An answer whose citations travel. Pick a numbered chip and a copy flies on an arc to its source, which lands with a small pop and a flash, so you see which card it means. Back, or Escape, flies it home and puts focus on the chip again.
- Link a claim to its source
- Short answers with sources beside them
- Onboarding and demos
- Make citations obvious
Examples
Installation
npx knowns-ui@latest add citation-flyPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Citation fly 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/citation-fly
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 citation-fly
```
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/citation-fly/citation-fly.tsx
- components/ui/knowns/citation-fly/citation-fly-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/citation-fly, 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: "citation-fly" }) 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
- textrequired
string- The answer, with [1] or [1, 3] markers numbered in the order of sources. A number with no source stays text.
- sourcesrequired
FlySource[]- id, title, domain, and optionally url, quote and meta (a short line such as Updated 12 Nov).
- active / defaultActive
number|null- Default
null - The picked source, 1-based. Controlled when active is set.
- onActiveChange
(n | null) => void- A chip, Back or Escape changed the pick.
- sourcesLabel
string- Default
"Sources" - The heading over the cards.
- Motion
-- The flight is travel across the component, 280 to 560ms by distance, ease in-out, lifting to 1.06 at most; the card lands with a 1.5% pop and the motion lib's flash. A new pick cancels a flight in the air. Reduced motion: no flight, the card is marked and focused at once.
| Prop | Type | Default | Description |
|---|---|---|---|
| textrequired | string | required | The answer, with [1] or [1, 3] markers numbered in the order of sources. A number with no source stays text. |
| sourcesrequired | FlySource[] | required | id, title, domain, and optionally url, quote and meta (a short line such as Updated 12 Nov). |
| active / defaultActive | number | null | null | The picked source, 1-based. Controlled when active is set. |
| onActiveChange | (n | null) => void | - | A chip, Back or Escape changed the pick. |
| sourcesLabel | string | "Sources" | The heading over the cards. |
| Motion | - | - | The flight is travel across the component, 280 to 560ms by distance, ease in-out, lifting to 1.06 at most; the card lands with a 1.5% pop and the motion lib's flash. A new pick cancels a flight in the air. Reduced motion: no flight, the card is marked and focused at once. |
Accessibility
- Each chip is a toggle button named with its source and pointing at the card with aria-controls.
- Picking moves focus to the card at once (it does not wait for the flight); Back and Escape return it to the chip that opened it.
- The picked card is marked with aria-current and a stronger border, not by colour alone.
What it handles
- 01Reads [1] and [1, 3] markers out of the answer text; a number with no source stays text.
- 02Marks and focuses the picked source at once, then flies a copy of the chip on an arc to the source's number.
- 03Lands the card with a small pop and a flash, and opens its full quote with a Back button.
- 04Flies home on Back or Escape and returns focus to the chip that opened it.
- 05Lays the sources beside the answer from 44rem of width and under it below; the arc bows sideways when it travels down.
- 06Cancels a flight still in the air when another chip is picked, so quick clicks never queue up.
States
- First render
- Nothing
- none
- Chip picked
- A copy of the chip flies to the source, faster for a short hop
- 560ms at most, ease in-out
- Card lands
- A 1.5% pop with a small overshoot, then a background flash
- 280ms, ease out
- Back
- The chip flies home and flashes
- 560ms at most, ease in-out
- Reduced motion
- No flight; the card is marked and focused at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing | none |
| Chip picked | A copy of the chip flies to the source, faster for a short hop | 560ms at most, ease in-out |
| Card lands | A 1.5% pop with a small overshoot, then a background flash | 280ms, ease out |
| Back | The chip flies home and flashes | 560ms at most, ease in-out |
| Reduced motion | No flight; the card is marked and focused at once | 0ms |
Works with
When to use
When to use
- Short answers with a few sources beside them, where seeing which card a number means is the point.
- Demos and onboarding where the link between a claim and its source should be obvious.
When not to use
- Many citations with previews of the matched passage: use Citations.
- An answer wired to sentences and quotes: use Grounded Answer.
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 Citation Fly to my app and wire it to my own data.
- I need short answers with a few sources beside them, where seeing which card a number means is the point. Set that up with the Knowns UI Citation Fly.
- Which Citation Fly props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "citation-fly" }) and search_docs({ query: "citation fly" }).