Skip to content
satin

Citations

Numbered sources in an answer, with a preview on hover and the list under it.

Order 24 kg of tomatoes from Fresh Farm: it drops to €2.10/kg over 20 kg1 and you have only 2 days of stock left3. At €842.50 the order needs a manager’s approval2.

Installation

Terminal
npm i @uisatin/ui
Import
import { Citation, Sources } from '@uisatin/ui/citations'

About 31.2 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

The Citation component is a numbered link with a HoverCard preview of its source; Sources folds the list of sources into a pill that opens it.

PropTypeDefault
Citation.index
number
—
Citation.source
CitationSource
—
Sources.sources
CitationSource[]
—
Sources.defaultOpen
boolean
false
CitationSource
{ title, origin?, href?, icon?, quote? }
—
className
string
—
ref
Ref<HTMLAnchorElement>
—
...props
ComponentProps<'a'>

Other attributes go to <a>

—

Accessibility

Citation is a link named "Source 2: <title>" (aria-label overrides it) that opens its source in a new tab; without href it is not focusable. Its preview is a hover card that opens on hover or focus and can’t be reached by keyboard, so keep the quote in the Sources list too. Sources is a button with aria-expanded and aria-controls over an ordered list of links; while folded, the list is hidden from the tab order and screen readers.

KeyAction
TabFocusing a citation opens its preview after a short delay.
EscCloses the preview.
EnterorSpaceOn Sources: opens or folds the list.