WebberUI

AI Source Citations

Inline citation markers in an AI answer, with a source preview card that floats out on hover.

This is a WebberUI Pro component

Free during the launch campaign: sign up or sign in, then hit “Copy install command” in the preview above and it installs straight away — no payment, no credit card. The command below returns 401 while you are signed out.

How to install Pro components →See the plans →

Superscript [1][2] citation markers embedded in an AI answer's paragraph: hovering or clicking one floats out a source preview card (favicon color swatch, title, snippet, and domain link), and the source list at the bottom highlights in both directions with the markers — a good fit for RAG Q&A, AI search, and anywhere the basis for an answer needs to be shown.

Loading preview…
npx shadcn@latest add "https://webberui.com/r/ai-source-citations.json?t=<install token>"

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

<AiSourceCitations />

Installation

npx shadcn@latest add "https://webberui.com/r/ai-source-citations.json?t=<install token>"

Or, once registries are configured in components.json, install it as @webberui/ai-source-citations.

Usage

import { AiSourceCitations } from "@/components/ui/ai-source-citations";

<AiSourceCitations
  segments={[
    { text: "RAG has the model retrieve external knowledge before it answers", citations: [0] },
    { text: ", which effectively reduces hallucination and supplies the basis.", citations: [1] },
  ]}
  sources={[
    {
      title: "What is Retrieval-Augmented Generation?",
      domain: "aws.amazon.com",
      snippet: "Having the model consult an authoritative external knowledge base before generating a response…",
      url: "https://aws.amazon.com/what-is/retrieval-augmented-generation/",
    },
    {
      title: "A practical guide to RAG",
      domain: "ithome.com.tw",
      snippet: "Retrieving relevant document fragments from a vector database and then synthesizing an answer…",
    },
  ]}
/>

Props

PropTypeDefaultDescription
segmentsCitationSegment[]List of answer segments, rendered in order into a single paragraph
segments[].textstringThe answer text of this segment
segments[].citationsnumber[]The sources to mark after this segment's text (0-based indices into sources)
sourcesCitationSource[]List of cited sources; the array order is the marker number (starting at 1)
sources[].titlestringSource title, shown in the preview card and the bottom list
sources[].domainstringSource domain, used for the favicon swatch letter and the domain row
sources[].snippetstringSnippet of the source content, shown in the hover preview card (up to two lines)
sources[].urlstringOptional link; when provided, the preview card's domain row and the list item become clickable
showSourceListbooleantrueWhether the source list at the bottom is shown (highlighting in sync with the inline markers)
classNamestringForwarded to the outermost container, merged through cn()

Accessibility

  • Citation markers are native <button> elements, focusable with Tab; focusing one opens the preview card, and Escape closes it
  • Markers carry aria-expanded and a complete aria-label (including the number and the source title), and the preview card is role="tooltip"
  • It only closes once focus leaves both the marker and the card, so keyboard users can Tab into the source link inside the card
  • When "reduce motion" is enabled at the system level, the preview card only fades in and out, with no shift or scale animation
  • Decorative elements like the favicon swatch and the small arrow are all marked aria-hidden and do not interfere with announcement

On this page