Sources

Citation list for retrieved documents and grounded answer references.

Sources lists the documents behind a grounded answer. Use the collapsible list under a message, and SourcePreview for inline citation chips.

Installation

pnpm dlx cubix@latest add sources --base aria

Usage

Import
import {
  Source,
  Sources,
  SourcesContent,
  SourcesTrigger,
} from "@/components/cubix/sources"
Example
<Sources count={3} defaultOpen>
  <SourcesTrigger />
  <SourcesContent>
    <Source href="https://example.com" title="Example" />
  </SourcesContent>
</Sources>

Composition

 
Sources
├── SourcesTrigger
└── SourcesContent
    ├── Source
    └── SourcesEmpty

SourcePreview

Features

  • Compact trigger with source count and chevron
  • Citation rows with favicon, title, host, and external link
  • Inline SourcePreview hover cards for in-text citations

Collapsed

Single source

Empty

This answer was not grounded in retrieved documents.

Without favicons

Inline preview

Keep rollback ready and watch p95 for the first hour. The RAIL model still applies for deploy UX budgets.

Custom label

Controlled

In a message

API Reference

Sources

PropTypeDefaultDescription
countnumber0Number of cited sources shown in the default trigger label.
openboolean-Controlled open state for the citation list.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void-Called when the list opens or closes.

SourcesTrigger

PropTypeDefaultDescription
labelReact.ReactNode-Custom trigger text. Defaults to "1 source" or "N sources" from count.
childrenReact.ReactNode-Optional custom trigger content.

Source

PropTypeDefaultDescription
hrefstring-Destination URL opened in a new tab.
titleReact.ReactNode-Primary citation title. Falls back to hostname or href.
descriptionReact.ReactNode-Optional supporting snippet under the title.
hostnamestring-Override hostname used for the subtitle and favicon.
showFaviconbooleantrueShow a favicon badge derived from the hostname.

SourcePreview

PropTypeDefaultDescription
hrefstring-Linked source opened from the hover card.
titleReact.ReactNode-Title shown in the hover card.
descriptionReact.ReactNode-Short preview text inside the hover card.
childrenReact.ReactNode-Inline citation marker content, e.g. [1].