The works a page draws on and the credits it owes, each with kind, title, authors and license.
<ol class="cap-sources" id="sl-mixed">
<li class="cap-source"><span class="cap-source-kind">Article</span><a class="cap-source-title" href="https://example.org/paper" data-link="away" rel="external noopener noreferrer">A field guide to field notes<span class="cap-sr-only"> (opens another site)</span></a><span>Alex Rivera, Sam Lee</span><span>Example Press</span></li>
<li class="cap-source"><span class="cap-source-kind">Book</span><span class="cap-source-title">The annual report, collected</span><span>Jordan Park</span><span>Example Co</span><span class="cap-source-note">Second edition</span></li>
<li class="cap-source"><span class="cap-source-kind">Music</span><a class="cap-source-title" href="https://example.net/theme" data-link="away" rel="external noopener noreferrer">Spring update theme<span class="cap-sr-only"> (opens another site)</span></a><span>Sam Lee</span><span class="cap-source-license">CC BY 4.0</span></li>
</ol>
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/sources-list.css";
import "capsomer/tokens.css";
import "capsomer/sources-list.css";
import { SOURCE_KINDS, SourcesList } from "capsomer/react/sources-list";
Usage
<details class="cap-disclosure">
<summary><h2>Sources and credits</h2></summary>
<div class="cap-disclosure-body">
<ol class="cap-sources">
<li class="cap-source">
<span class="cap-source-kind">Article</span>
<a class="cap-source-title" href="https://example.org/paper">Title<span class="cap-sr-only"> (another site)</span></a>
<span>Alex Rivera, Sam Lee</span><span>Example Press</span>
<span class="cap-source-license">CC BY 4.0</span><span class="cap-source-note">Read in 2024</span>
</li>
</ol>
</div>
</details>
Examples
In a closed disclosure
<details class="cap-disclosure" id="sl-closed">
<summary><h3>Sources and credits</h3></summary>
<div class="cap-disclosure-body">
<ol class="cap-sources">
<li class="cap-source"><span class="cap-source-kind">Image</span><span class="cap-source-title">Cover photograph</span><span>Jordan Park</span><span class="cap-source-license">CC BY-SA 4.0</span></li>
</ol>
</div>
</details>
API reference
SourcesList
| Prop | Type | Required | Does |
|---|
sources | Source[] | Yes | |
|---|
label | string | | |
|---|
isExternal | (url: string) => boolean | | Whether an address leaves the site, for its hidden "(another site)" cue. Every absolute http(s) address by default. |
|---|
markAway | boolean | | Mark a link to another site with the link system's ↗ (data-link="away"). Off by default. |
|---|
CSS variables
| Variable | Default |
|---|
--cap-source-kind-pad | 1px var(--space-2) |
|---|
Parts and data attributes
| Class | Is |
|---|
.cap-source | its own class |
|---|
.cap-source-kind | its own class |
|---|
.cap-source-license | its own class |
|---|
.cap-source-note | its own class |
|---|
.cap-source-title | its own class |
|---|
.cap-sources | the root |
|---|
| Attribute | Values |
|---|
data-link | present or absent |
|---|
| State | Read from |
|---|
:visited | the platform |
|---|
Accessibility
| Key | Does |
|---|
| Tab | Moves through the linked titles |
- Kind tag and details in
--muted, titles --text or --accent-text: in the contrast report.