Inline Citation
A source inside the sentence it supports, with the links one hover or tap away.
NewInstallation
Copy and paste the following code into your project.
Update the import paths to match your project structure.
Anatomy
Each source is
{ url, title, description? }. The chip shows the host of the first source and how many more there are ("docs.stripe.com +1"). Hovering, focusing or tapping it opens a card with every source as a link.Pass
children to underline the exact words the sources back. Leave them out to place only the chip, at the end of a sentence. Sources lists every link of an answer at the bottom; Inline Citation ties a link to one claim. Use both when an answer has many claims.Keyboard
Tab reaches the chip and opens the card. Tab again moves into its links. Escape closes it.Accessibility
- The chip is a real button named "docs.stripe.com +1, 2 sources", so it reads as more than a host name.
- Links open in a new tab with
rel="noreferrer". - With no sources, it renders only the text, so a citation that failed to load never shows an empty chip.
API Reference
InlineCitation
| Prop | Type | Default | Description |
|---|---|---|---|
sources | InlineCitationSource[] | - | { url, title, description? } for each source |
children | ReactNode | - | The words the sources back, underlined |
label | string | host of the first | Replaces the chip text, for example "1" |
sourcesLabel | (count: number) => string | "2 sources" | Count read by screen readers |
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.