Skip to content
synccn

Sources

New

Inline citation numbers with a preview on hover, and a "Used 3 sources" list that matches them.

You can drop most JavaScript tooltip libraries now. The Popover API puts the panel in the top layer1, and CSS anchor positioning keeps it next to its button2. Both are Baseline in current browsers3.

Installation

$ pnpm dlx shadcn@latest add @synccn/sources

First 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
    boolean

    Default false

    Open at first.

  • className
    string

    Extra classes for the root element.

Citation

Inline citation number. Hover or focus shows the source's title, site and quoted passage.

  • indexrequired
    number

    Number shown, from 1.

  • sourcerequired
    Source

    —

  • className
    string

    Extra 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

npm packages

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