Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-citation.json --yes

Citation

Pro

A 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.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-citation.json --yes
PROMPT
Add the Goop Citation to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { ChatMessage } from '@/components/ui/goop/chat-message';
import { Citation, CitationList, type CitationSource } from '@/components/ui/goop/citation';

const recordings: CitationSource = {
  title: 'How long session recordings are kept',
  site: 'help.fieldwork.example',
  href: '/help/recordings',
};
const plan: CitationSource = {
  title: 'Diallo Dental: study plan',
  site: 'fieldwork.test',
  href: '/studies/diallo',
  icon: 'file-text',
};

function Answer() {
  return (
    <ChatMessage author="Assistant" time="09:41">
      <p>
        Recordings are deleted 90 days after a study closes.
        <Citation index={1} source={recordings} /> The Diallo Dental plan keeps them for 30 days.
        <Citation index={2} source={plan} />
      </p>
      <CitationList sources={[recordings, plan]} />
    </ChatMessage>
  );
}
  • 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 sources is enough.
  • height, width, padding, gap, corner, background, text, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
previewOpen?booleanThe card shown (controlled); pair it with onPreviewOpenChange.
onPreviewOpenChange?(open: boolean) => voidCalled with the card's new open state.
container?HTMLElement | nullWhere the card is portalled; the end of <body> when left out.
indexnumberThe source's number in its answer (1, 2, …), shown on the chip and said in its name.
sourceCitationSourceThe source the chip cites.
onOpen?(source: CitationSource) => voidOpen the source yourself (a side panel of your own): the chip becomes a button that calls it with the source.
target?HTMLAttributeAnchorTargetWhere 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?stringYour 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 }
Parts
PartWhat it is
CitationListThe 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.

TSX
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 its rel).
  • 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

KeyWhat it does
EnterFollow the link to the source (with onOpen, Enter or Space hands the caller the source)
TabMove 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
EscapeClose 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:

StateDrawn by
expandedthe attribute data-state=open
openthe attribute data-state=open

Motion

  • The part sets its own motion: add no transition or animation of your own.

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.

goop.so/themes/meadow/components/citation.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-citation.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.