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";
import "capsomer/tokens.css";
import "capsomer/subscribe-links.css";
import { SubscribeLinks } from "capsomer/react/subscribe-links";
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
SubscribeLinks
| Prop | Type | Required | Does |
|---|
title | ReactNode | | |
|---|
headingId | string | | The heading's id, which names the section. |
|---|
level | "h2" | "h3" | | |
|---|
links | SubscribeLink[] | 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 }) => ReactNode | | Draw a link with the app's router link (the "more" page is the site's own). |
|---|
Parts and data attributes
| Class | Is |
|---|
.cap-subscribe | the root |
|---|
.cap-subscribe-link | a part |
|---|
.cap-subscribe-list | a part |
|---|
.cap-subscribe-more | a part |
|---|
.cap-subscribe-title | a part |
|---|
| State | Read from |
|---|
:hover | the platform |
|---|
Accessibility
| Key | Does |
|---|
| Tab | Moves 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).