Skip to content

Sources list

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";

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

PropTypeRequiredDoes
sourcesSource[]Yes
labelstring
isExternal(url: string) => booleanWhether an address leaves the site, for its hidden "(another site)" cue. Every absolute http(s) address by default.
markAwaybooleanMark a link to another site with the link system's ↗ (data-link="away"). Off by default.

CSS variables

VariableDefault
--cap-source-kind-pad1px var(--space-2)

Parts and data attributes

ClassIs
.cap-sourceits own class
.cap-source-kindits own class
.cap-source-licenseits own class
.cap-source-noteits own class
.cap-source-titleits own class
.cap-sourcesthe root
AttributeValues
data-linkpresent or absent
StateRead from
:visitedthe platform

Accessibility

KeyDoes
TabMoves through the linked titles
  • Kind tag and details in --muted, titles --text or --accent-text: in the contrast report.