Ballmac UI home

Cited Answer

New

An AI answer you can check: numbers in the text are buttons that light up every claim a source supports and open its excerpt, and the source list works the other way round. Says how many sentences are cited.

v1.0.1Updated Oct 25, 2026Ships with a test
What changed
  1. 1.0.1 Oct 25, 2026The number buttons are larger and spaced apart, so they are easy to hit on a touch screen.
  2. 1.0.0 Oct 25, 2026First release.

Update without losing your edits

Can I get my money back for the damaged speaker?

Yes. Because the speaker arrived damaged, you are covered by the 14-day refund policy, and return shipping is free.

Send a photo with your request and a prepaid label arrives within one business day. You can take the refund to your card, or keep it as store credit that never expires. I would start with the photo, since it is the quickest step.

4 of 5 sentences are cited

Sources3

Installation

$ pnpm dlx shadcn@latest add @ballmac/cited-answer

Usage

import { CitedAnswer, parseParagraph } from "@/components/ballmac/cited-answer"

The full example is in the Code tab above.

Examples

One source

The Team plan covers up to ten people for a single payment of $349.

Sources1

API reference

PropTypeDefault
paragraphs*

The answer, one string per paragraph. Write [1] or [2, 3] after a claim to cite the sources in that order.

string[]—
sources*

The sources the numbers point to, in order.

CitationSource[]—
question

Shown above the answer, for example the question that was asked.

string—
showCoverage

Show how many sentences are cited. Defaults to true.

booleantrue

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
NumbersButtons named 'Source n: title' with pressed state; they work with Enter and Space and show focus
SourcesEach row is a button naming the source and how often it is cited; a separate link opens it
HighlightAnnounced politely ('Highlighting 2 claims from …'); Escape clears; cited claims are underlined as well as tinted
CoverageThe count of cited sentences is text, not only a bar

Use with AI

paragraphs is string[]; write [1] or [2, 3] after a claim to cite sources by their position in sources ({ title, url, site?, date?, snippet?, favicon? } as in citation). question shows above. showCoverage (default true) adds 'N of M sentences are cited'. Choosing or hovering a number, or a source row, highlights every claim that source supports and opens its snippet; Escape clears. Unknown numbers are ignored. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Cited Answer (@ballmac/cited-answer) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • A RAG or search answer where people need to see where each claim came from
  • Support and research assistants that must be checkable

Not for

  • A plain chat reply with no sources; use ai-message
  • Checking claims against sources automatically; use citation-coverage

Registry JSON: https://ui.ballmac.com/r/cited-answer.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.