Skip to Content
zjkm-ui
Components

Citation Chips

Citation chips that fan out.

Hover or tab to the sources to fan them out.

Props
14px
<CitationChips items={sources} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/citation-chips.json
import { CitationChips } from "@/components/citation-chips"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

Shows an answer's sources as a compact stack of numbered badges. Hovering or tabbing into the stack fans them out into labelled chips. Every chip is a real link in a list, in your order, so keyboard and screen reader users get each source.

import { CitationChips } from "@/components/citation-chips";

const sources = [
  { label: "react.dev", href: "https://react.dev" },
  { label: "MDN Web Docs", href: "https://developer.mozilla.org" },
];

export function AnswerFooter() {
  return <CitationChips items={sources} />;
}

The chip background is Canvas, the page's own background colour. Set --zjkm-chip-bg to change it.

Props

PropTypeDefaultDescription
items{ label: string; href: string }[]The sources, in order.
overlapnumber14Pixels between the stacked badges.
classNamestringClasses for the <ul>.

With reduced motion, the chips fan out without sliding.

On this page