All components (283)
Sources
AI · Sources
What it is and when to use it
The sources an answer relied on: a folded block that says how many there are and, open, lists them numbered with their domain.
When to use it
- An answer from an assistant that cites pages or documents.
sourcesare the sources, in the order they are cited:{ key, title, url, description? }. Each one has an anchor (sourceAnchor) thatInlineCitationleads to.
When not to
- A single link:
Link. - Attached files:
Attachment.
Keyboard: the title is the button that folds and opens; Tab goes through the links.
Accessibility: each link opens in a new tab and says so with hidden text; the domain is written out. The source reached from a citation is marked with the focus ring.
Fine-tuning: amset-sources and the amset-sources__* classes.
What it looks like
- Web accessibility guide (opens in a new tab)w3.orgThe WCAG 2.2 guidelines, explained.
- HTML documentation (opens in a new tab)developer.mozilla.org
- Accessibility guidelines for applications (opens in a new tab)w3.orgAn introduction to web accessibility, in Spanish.
<Sources
sources={[
{ key: "a", title: "Web accessibility guide", url: "https://www.w3.org/WAI/standards-guidelines/wcag/" },
{ key: "b", title: "HTML documentation", url: "https://developer.mozilla.org/es/docs/Web/HTML" },
{
key: "c",
title: "Accessibility guidelines for applications",
url: "https://www.w3.org/WAI/fundamentals/accessibility-intro/es",
},
]}
defaultExpanded
/>Props
Import it with import { Sources } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
sourcesrequired | readonly Source[] | The sources, in the order they are cited: `{ key, title, url, description? }`. |
className | string | Merged with the library classes; it does not replace them. |
defaultExpanded | boolean | Open at the start. Closed by default: an answer with ten sources does not have to begin with them. |
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:
