Sources
NewInline citation numbers with a preview on hover, and a "Used 3 sources" list that matches them.
Installation
$ pnpm dlx shadcn@latest add @synccn/sourcesFirst time in this project? Connect synccn with one command.
Usage
import { Sources, Citation } from "@/components/ui/sources";Text<Citation index={1} source={sources[0]} /><Sources sources={sources} />API reference
Generated from the component's TypeScript types, so it always matches the code.
Sources
"Used 4 sources" summary that opens into a numbered list of links, matching inline Citation numbers.
- sourcesrequired
Source[]—
- defaultOpen
booleanDefault
falseOpen at first.
- className
stringExtra classes for the root element.
Citation
Inline citation number. Hover or focus shows the source's title, site and quoted passage.
- indexrequired
numberNumber shown, from 1.
- sourcerequired
Source—
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for ChevronDown, ExternalLink
Used by
Keyboard
- TabFocus a citation to preview its source
Accessibility
- Citations are links named "Source 1: title", and the preview is a tooltip linked with aria-describedby.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: tooltip
- ARIA attributes: aria-controls, aria-describedby, aria-expanded, aria-label
- Shows a visible focus ring for keyboard users