Citations

Numbered markers you drop into an answer's text, linked to a source list that opens and closes, fills in row by row and shows each site's favicon, title and domain, plus a stacked-favicon summary for compact footers.

Preview

Citations preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/citations
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

Citation

citationId
string
—
index
number
—
idPrefix
string

Must match the related Citations idPrefix.

—
className?
string
—

CitationFavicon

url?
string
—
className?
string
—

CitationStack

citations
CitationItem[]
—
limit?
number
3
className?
string
—

CitationList

citations
CitationItem[]
—
idPrefix?
string
—
className?
string
—

Citations

citations
CitationItem[]
—
title?
ReactNode
Sources
open?
boolean
—
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
—
idPrefix?
string
—
className?
string
—

Composition

Keep the inline markers and the source list in the same answer so their ids match.

StreamingResponse
├── Citation
└── Citations
    ├── CitationStack
    └── CitationList

Note: Streaming Response opens the source summary after the answer finishes. Message keeps the cited answer in a proper transcript row.

How it works

A citation ties one claim to its evidence and stays out of the reader's way. Markers in the text should be small; the source list carries enough detail for someone to go and check.

Updated