Citations
Numbered source references and a list of the sources behind an answer.
Use a stable sort so rows with equal values keep their order , mark the sorted column with aria-sort , and compare text with Intl.Collator so “item 2” comes before “item 10” .
Sources
When to use
- An answer draws on documents or web pages the reader may want to check.
- You need hover or focus previews of each source.
When not to use
- The content has no sources to cite.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/citations
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
Citation
2 props
PropTypeDefault
index *number—
source *Source—
SourceList
3 props
PropTypeDefault
sources *readonly Source[]—
labelstring"Sources"
classNamestring—
Keyboard
- Keyboard and focus come from Radix popover: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.
Accessibility
It is built on native elements and keeps aria-label and aria-hidden in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/citations.mdThe index of every part is at /llms.txt.