OfferLifetime Pro for $99

Inline Citations

An answer with [1] markers drawn as chips or footnotes. Each opens a preview with the site, the title and the quoted passage, lights up the sentence it supports, and lists the sources under the answer.

The decision inside it

A missing source is shown, never dropped

A marker with nothing behind it is drawn as a dashed "?" that says Source missing. A model citing something it never retrieved is the failure citations exist to catch, so the component makes it visible.

When to use it

Use Inline Citations to render an AI answer that cites sources: [1] or [^id] markers become chips or footnotes with a preview of the source, and the cited sentence lights up. For checking whether each claim is supported, use Citation Verification.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Inline Citations for this.
Install it: npx shadcn@latest add @layro/inline-citations
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/inline-citations.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/cited-answer.tsx
import { InlineCitations, type CitationSource } from "@/components/ui/inline-citations";

export function CitedAnswer({ answer, sources }: { answer: string; sources: CitationSource[] }) {
  return <InlineCitations content={answer} sources={sources} showSourceList />;
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
contentrequiredstringThe answer, with [1] or [^id] markers. Blank lines separate paragraphs.
sourcesrequiredCitationSource[]What the markers point at.
variant"inline" | "footnotes""inline" chips in the text, or "footnotes" with superscript numbers. Default inline.
highlightOnHoverbooleanLight up the sentence a citation supports while it is hovered or focused. Default true.
onSourceClick(source: CitationSource) => voidCalled when a source is opened from a preview or the list. Without it, sources with a url open in a new tab.
showSourceListbooleanSource cards under the answer. Default false (true for footnotes).

Dependencies

npm packages

@radix-ui/react-popoverclsxlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Inline
  • Footnotes
  • Preview open
  • Sentence lit
  • Missing source

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.