Skip to content

Subscribe links

Where to follow a show or a site, as a titled card of pill links to each app and the feed.

<section class="cap-subscribe" id="sub-full" aria-labelledby="sub-full-h">
  <h3 class="cap-subscribe-title" id="sub-full-h">Listen and subscribe</h3>
  <ul class="cap-subscribe-list">
    <li><a class="cap-chip cap-subscribe-link" data-size="sm" href="https://podcasts.example.com/field-notes" data-link="away" rel="external noopener noreferrer"><svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="5" fill="currentColor"/></svg>Example Podcasts<span class="cap-sr-only"> (opens another site)</span></a></li>
    <li><a class="cap-chip cap-subscribe-link" data-size="sm" href="https://music.example.net/field-notes" data-link="away" rel="external noopener noreferrer"><svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="5" fill="currentColor"/></svg>Example Music<span class="cap-sr-only"> (opens another site)</span></a></li>
    <li><a class="cap-chip cap-subscribe-link" data-size="sm" href="#feed"><svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 3a10 10 0 0 1 10 10M3 7a6 6 0 0 1 6 6" fill="none" stroke="currentColor" stroke-width="2"/><circle cx="4" cy="12" r="1.5" fill="currentColor"/></svg>RSS</a></li>
    <li><a class="cap-subscribe-more" href="#subscribe">More ways to listen</a></li>
  </ul>
</section>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/subscribe-links.css";

Usage

<section class="cap-subscribe" aria-labelledby="subscribe">
  <h2 class="cap-subscribe-title" id="subscribe">Listen and subscribe</h2>
  <ul class="cap-subscribe-list">
    <li><a class="cap-chip cap-subscribe-link" data-size="sm" href="https://podcasts.example.com/show" rel="external" data-link="away"><svg aria-hidden="true">...</svg>Example Podcasts</a></li>
    <li><a class="cap-chip cap-subscribe-link" data-size="sm" href="/feed/podcast/"><svg aria-hidden="true">...</svg>RSS</a></li>
    <li><a class="cap-subscribe-more" href="/subscribe">More ways to listen</a></li>
  </ul>
</section>

API reference

PropTypeRequiredDoes
titleReactNode
headingIdstringThe heading's id, which names the section.
level"h2" | "h3"
linksSubscribeLink[]Yes
more{ href: string; label: ReactNode }The page with every way to follow ("More ways to listen"), last.
renderLink(props: { href: string; className: string; children: ReactNode }) => ReactNodeDraw a link with the app's router link (the "more" page is the site's own).

Parts and data attributes

ClassIs
.cap-subscribethe root
.cap-subscribe-linka part
.cap-subscribe-lista part
.cap-subscribe-morea part
.cap-subscribe-titlea part
StateRead from
:hoverthe platform

Accessibility

KeyDoes
TabMoves through the links in order
  • A section named by its heading, and a ul of links.
  • Every pill is at least --target tall, and its text reaches 4.5:1 (checked in the spec).