Skip to content

Citation

A numbered marker in a reply that links to a source and previews it on hover.

Point www.example.com at your site with a CNAME record 12. It usually works within a few minutes.

Installation

  1. Add the registryOnce per project
  2. Add citation

Usage

A citation is a Hover Card. CitationTrigger is a small numbered link in the text that opens the source on another site in a new tab. CitationContent previews the source while someone hovers over or focuses the link. On a touch screen, the first tap shows the preview and a second tap follows the link.

Give the trigger an aria-label that starts with its number and names the source, such as Source 1: Rate limits. The number alone doesn't say what the link cites, and a label that includes the number still matches what voice control users see.

Put a space before the citation, as a model's reply does. The marker stays on the same line as the word before it, and punctuation after the marker stays on its line too. Adjacent markers sit 4px apart.

Composition

Examples

In a reply

Models cite sources with numbered links, such as [1](https://example.com/docs/rate-limits). Pass Markdown a link component that renders a citation for each URL you have a source for and falls back to MarkdownLink for the rest. The AI SDK sends the sources a reply used as source-url parts, each with a url and title. TanStack AI doesn't send sources, so take them from the output of the tool that found them.

You can make 100 requests a minute with each key 1. Past that, the API answers with a 429 and a Retry-After header saying how long to wait 2.

To list every source a reply read, use an expandable Trace line.

Props

Base UI's styling (opens in a new tab) and composition (opens in a new tab) guides say more about className, style and render.

Citation

CitationTrigger

CitationContent

CitationSource

CitationTitle

CitationDescription