Sources and citations
Paragraph with numbered citations; hovering or focusing one draws a dotted beam to its source chip and loads a preview card.
Installation
pnpm dlx shadcn@latest add @lumesec/hf-sourcesFirst timeRegister the @lumesec registry once, or install by URL+
Adds @lumesec to your components.json:
pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/hf-sources.jsonUsage
import { HfSources } from "@/components/lumesec/hf-sources";
export function Example() {
return (
<HfSources />
);
}Behaviour
Hovering a citation draws a dotted beam to its source chip with packets running along it. The preview loads with a pixel skeleton, and each favicon is the domain's first letter on a dotted tile.
API reference
Events
Events bubble and cross the shadow boundary unless the description says otherwise.
openReact proponOpenDetail{ source: { t: string, d: string, s: string } }Fires when a citation or source chip is clicked. t is the title, d the domain and s the snippet.
Accessibility
- Citations are buttons with an
aria-labelsuch asSource 1: <title>. - Source chips are
<a href="#">elements withrole="listitem"inside arole="list"; that role replaces the link role, and clicks do not navigate. - Focusing a citation or chip with Tab selects it, the same as hovering.
- The preview card is an
aria-live="polite"region. - Favicon letters are
aria-hiddentext; their tiles, the beam and the loading skeleton are drawn on anaria-hiddencanvas. - Reduced motion: the preview fills in without the skeleton delay, the beam is drawn whole without packets, and drawing stops between interactions.
Theming
The element reads your shadcn theme tokens through its shadow root, so light and dark follow your theme. The accent comes from --lumesec. See Theming.
This component reads --border, --card, --foreground, --lumesec and --muted-foreground.
To restyle only LumeSec elements, set the matching --ui-* overrides: --ui-accent, --ui-border, --ui-fg, --ui-muted and --ui-surface.
Notes
- The paragraph, three citations and three sources are built-in demo content and cannot be configured.
- Chips do not open URLs; handle
opento navigate. - Favicons are the first letter of the domain, set as text on a dotted tile in a colour derived from the domain.
- Without reduced motion, the packets keep the canvas redrawing every frame while the element is visible.
Related
Was this page helpful?