Ballmac UI home

Citation

An inline source marker for AI answers, as a numbered chip or a site pill. Hover or focus opens a preview card with title, excerpt and link, and a pager when one claim has several sources.

Arctic sea ice is tracked by satellites that sense microwave emission from the surface1. This year's minimum was the second lowest since records began2, and the trend across four decades is downward.

Installation

$ pnpm dlx shadcn@latest add @ballmac/citation

Usage

import { Citation, SourceFavicon, hostOf } from "@/components/ballmac/citation"

The full example is in the Code tab above.

Examples

Site pills with several sources

The team plan costs $12 per seat a month on yearly billingAcme+2, and the free tier now includes three projectsAcme Blog.

API reference

<SourceFavicon>

PropTypeDefault
source*Pick<CitationSource, "url" | "site" | "favicon">—

<Citation>

PropTypeDefault
sources*

The source, or several sources backing one claim. With several, the card gets a pager.

CitationSource | CitationSource[]—
index

Number shown in the marker. Ignored by the "pill" style.

number1
variant

"number" is a small superscript-style chip like [1]. "pill" shows the site name with a +N count.

"number" | "pill""number"

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabFocuses the marker and opens its card
EnterOpens the source in a new tab
Screen readersNamed 'Source 1: Title', with 'and 2 more' for grouped sources

Use with AI

Place <Citation index={1} sources={{ title, url, snippet }} /> right after the claim. Pass an array for several sources. variant is number | pill. The marker is a real link, so touch users open the page directly. Also exports SourceFavicon and hostOf. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Citation (@ballmac/citation) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Answers grounded in web or document sources
  • Footnotes that should not pull the reader away from the text

Not for

  • A full list of references; use sources-list
  • Tooltips with no link; use tooltip

Registry JSON: https://ui.ballmac.com/r/citation.json

Credits

Free to use in personal and commercial projects.