Skip to content
EspañolEnglish
All components (283)

Inline citation

AI · InlineCitation

What it is and when to use it

The numbered citation inside a text: a small [2] that leads to its source.

When to use it

  • Marking where a sentence of an answer comes from, next to Sources.
  • number is the one of the source in the list; href is the address or the Sources anchor (#sources-source-2); title is the title of the source, which forms the name of the link.
  • On touch screens the hit area is about 28 × 47 px: two adjacent citations do not fit at 44 wide without overlapping, and spacing them further detaches the punctuation from the text. It exceeds the 24 px of WCAG 2.5.8.

When not to

  • A long footnote: a paragraph of its own.
  • A link inside the text: Link.

Keyboard: Tab goes to the citation and Enter opens it.

Accessibility: the name of the link says the number and the title ("Source 2: Accessibility guide"), because a bare "2" says nothing to someone who hears the page. The press area is larger than the digit.

Fine-tuning: amset-citation and amset-citation__link.

What it looks like

Normal text needs a minimum contrast of 4.5 to 1
Web accessibility guidew3.orgThe minimum contrast of normal text is 4.5 to 1.
.

<InlineCitation
  number={2}
  href="https://www.w3.org/WAI/standards-guidelines/wcag/"
  title="Web accessibility guide"
  source={{ host: "w3.org", snippet: "The minimum contrast of normal text is 4.5 to 1." }}
/>

Props

Import it with import { InlineCitation } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
hrefrequiredstringWhere it goes: the source `href` or the `Sources` anchor (`#sources-source-1`).
numberrequirednumberThe number of the source in the list: 1, 2, 3…
titlerequiredstringThe title of the source, for the link name: "Source 2: Accessibility guide". Required.
classNamestringMerged with the library classes; it does not replace them.
sourceCitationSourceIf given, pointing at or focusing the citation shows a card with the title, the site and the quoted fragment.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: