npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-citation.json --yesCitation
ProA source's small numbered chip inside an AI answer's words, right after the claim it backs, for React and Tailwind CSS. Part of Goop Pro.
When to use
- A source's small numbered chip inside an AI answer's words, right after the claim it backs.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Citation on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-citation.json --yesAdd the Goop Citation to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Citation, CitationList } from '@/components/ui/goop/citation';- Fits: chat (its recipe).
- Put the answer's words with their Citation chips in a ChatMessage's children, and the same sources, in the same order, in a CitationList row after the words; the chip numbered 2 cites the row's second source.
- CitationList: Under the answer's words in a ChatMessage's children, with the inline Citation chips in the words numbered as this row; for plain document chips with no site or preview, ChatMessage's own
sourcesis enough. - height, width, padding, gap, corner, border, background, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| previewOpen? | boolean | The card shown (controlled); pair it with onPreviewOpenChange. |
| onPreviewOpenChange? | (open: boolean) => void | Called with the card's new open state. |
| container? | HTMLElement | null | Where the card is portalled; the end of <body> when left out. |
| index | number | The source's number in its answer (1, 2, …), shown on the chip and said in its name. |
| source | CitationSource | The source the chip cites. |
| onOpen? | (source: CitationSource) => void | Open the source yourself (a side panel of your own): the chip becomes a button that calls it with the source. |
| target? | HTMLAttributeAnchorTarget | Where the link opens (_blank: a new tab, with its rel); a link alone. |
| sourceLabel? | string = 'Source' | The word before the number in the chip's name ("Source"). |
| className? | string | Your classes on the chip. |
- State: previewOpen (previewOpen / onPreviewOpenChange); drawn by data-state=open
- Types: CitationSource = { id?: string; title: string; site: string; href: string; icon?: IconName }
| Part | What it is |
|---|---|
| CitationList | The row of an AI answer's sources under its words; its props: citation--list.md |
- data-slot values (to select a part by): citation, citation-caption, citation-caption-icon, citation-content, citation-item, citation-item-label, citation-item-title, citation-list, citation-title
CitationList
The row of an AI answer's sources under its words.
import { CitationList } from '@/components/ui/goop/citation';Options
- sources: readonly CitationSource[] — The answer's sources, in the order its chips number them (the first is 1).
- onOpen?: (source: CitationSource) => void — Open a source yourself: every chip becomes a button that calls it with its source.
- target?: HTMLAttributeAnchorTarget — Where the links open (
_blank: a new tab, with itsrel). - label?: string = 'Sources' — The row's name for a screen reader ("Sources").
- sourceLabel?: string = 'Source' — The word before each number in a chip's name ("Source").
- className?: string — Your classes on the row.
- Types: CitationSource = { id?: string; title: string; site: string; href: string; icon?: IconName }
Keyboard
| Key | What it does |
|---|---|
| Enter | Follow the link to the source (with onOpen, Enter or Space hands the caller the source) |
| Tab | Move to the next chip: the answer's inline chips in their words' order, then the row's chips; the keyboard's focus on a chip shows its card |
| Escape | Close the chip's card; the focus stays on the chip |
Accessibility
- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| expanded | the attribute data-state=open |
| open | the attribute data-state=open |
Motion
- The part sets its own motion: add no transition or animation of your own.
- How the theme moves, and how to move your own parts the same way: Motion.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.