Skip to content

Panel

A bordered surface with a raised header, optional count and source, and a padded body.

<section class="cap-panel" id="p-head">
  <header class="cap-panel-head">
    <h3>Usage against free limits</h3>
    <span class="cap-panel-src">Cloudflare. Read 6 minutes ago</span>
  </header>
  <div class="cap-panel-body">
    <p>Worker requests: 61,400 of 100,000 today, about 84% by the reset at 00:00 UTC.</p>
    <p class="cap-muted">No projection for R2 storage yet: 2 days of history, 7 needed.</p>
  </div>
</section>

Installation

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

Usage

<section class="cap-panel">
  <header class="cap-panel-head">
    <h2>Usage against free limits</h2>
    <span class="cap-panel-src">Cloudflare. Read 6 minutes ago</span>
  </header>
  <div class="cap-panel-body">[content]</div>
</section>

<!-- holding a list or a table -->
<div class="cap-panel-body" data-flush>[a .cap-rows list or a .cap-table-wrap]</div>
<section class="cap-panel" id="sites" data-section="Sites">
  <header class="cap-panel-head">
    <h2>Sites</h2>
    <span class="cap-panel-count">6</span>
    <span class="cap-panel-src">Watcher pass 40 seconds ago</span>
    <span class="cap-panel-more"><a href="/sites">All columns in Sites</a></span>
  </header>
  ...
</section>
<section class="cap-panel" aria-labelledby="queue-h">
  <header class="cap-panel-head">
    <h2 id="queue-h">Queue</h2>
    <span class="cap-panel-action"><button type="button" class="cap-btn">Edit</button></span>
    <p class="cap-panel-desc">Jobs wait here until a driver takes them.</p>
  </header>
  <div class="cap-panel-body" data-flush>
    <div class="cap-panel-pad"><p>Two jobs are waiting.</p></div>
    [a .cap-rows list or a .cap-table-wrap, edge to edge]
  </div>
  <footer class="cap-panel-foot">[buttons or a link]</footer>
</section>

Examples

With a count, a source and a link to the full view

<section class="cap-panel" id="p-more" data-section="Sites">
  <header class="cap-panel-head">
    <h3>Sites</h3>
    <span class="cap-panel-count">6</span>
    <span class="cap-panel-src">Watcher pass 40 seconds ago</span>
    <span class="cap-panel-more"><a href="#sites">All columns in Sites</a></span>
  </header>
  <div class="cap-panel-body">
    <p>Six sites, all up. The table is on the Sites view.</p>
  </div>
</section>

Body only

<section class="cap-panel" id="p-body" aria-label="Release note">
  <div class="cap-panel-body">
    <p>Capsomer 0.1.0 shipped to the Capsid Portal on September 30. Nothing else uses it yet.</p>
  </div>
</section>

Holding a list, with no body padding

<section class="cap-panel" id="p-flush">
  <header class="cap-panel-head">
    <h3 id="p-flush-h">Recent drafts</h3>
    <span class="cap-panel-src">Carrel. Newest first</span>
  </header>
  <div class="cap-panel-body" data-flush>
    <ul class="cap-rows" data-cap="row-list" aria-labelledby="p-flush-h">
      <li class="cap-row">
        <span class="cap-row-status"><span class="cap-status" data-tone="info">Draft</span></span>
        <div class="cap-row-title"><a href="#p-flush">How the survey sites were chosen</a></div>
        <p class="cap-row-detail">412 words, one AI draft beside yours</p>
        <span class="cap-row-meta"><time datetime="2026-09-30T13:58Z">15 minutes ago</time></span>
      </li>
      <li class="cap-row">
        <span class="cap-row-status"><span class="cap-status" data-tone="ok">Published</span></span>
        <div class="cap-row-title"><a href="#p-flush">Notes on a quiet deploy</a></div>
        <p class="cap-row-detail">example.com, two reviewers</p>
        <span class="cap-row-meta"><time datetime="2026-09-29T21:14Z">yesterday</time></span>
      </li>
    </ul>
  </div>
</section>

Card parts: description, action, footer (a named panel)

<section class="cap-panel" id="p-card" aria-labelledby="p-card-h">
  <header class="cap-panel-head">
    <h3 id="p-card-h">Deploy settings</h3>
    <span class="cap-panel-action"><button type="button" class="cap-btn">Edit</button></span>
    <p class="cap-panel-desc">Where and how example.org is published.</p>
  </header>
  <div class="cap-panel-body">
    <p>Production deploys from <span class="cap-mono">main</span> after the browser tests pass.</p>
  </div>
  <footer class="cap-panel-foot">
    <button type="button" class="cap-btn" data-variant="primary">Deploy now</button>
    <span class="cap-muted">Last deploy 15 minutes ago</span>
  </footer>
</section>

A flush body with a padded block (cap-panel-pad)

<section class="cap-panel" id="p-pad" aria-labelledby="p-pad-h">
  <header class="cap-panel-head">
    <h3 id="p-pad-h">Queue</h3>
    <span class="cap-panel-count">2</span>
  </header>
  <div class="cap-panel-body" data-flush>
    <div class="cap-panel-pad"><p>Jobs wait here until a driver takes them. The rows below touch the panel's edges.</p></div>
    <ul class="cap-rows" data-cap="row-list" aria-labelledby="p-pad-h">
      <li class="cap-row">
        <div class="cap-row-title"><a href="#p-pad">Refresh the uptime strip fixtures</a></div>
        <p class="cap-row-detail">Priority 2</p>
        <span class="cap-row-meta">1 hour ago</span>
      </li>
      <li class="cap-row">
        <div class="cap-row-title"><a href="#p-pad">Run the browser tests for capsomer</a></div>
        <p class="cap-row-detail">Held by capsid-driver</p>
        <span class="cap-row-meta">18 minutes ago</span>
      </li>
    </ul>
  </div>
</section>

Small size and comfortable density

<section class="cap-panel" id="p-sm" data-size="sm">
  <header class="cap-panel-head"><h3>Small panel</h3></header>
  <div class="cap-panel-body"><p>data-size="sm" tightens the spacing.</p></div>
</section>
<section class="cap-panel" id="p-comfortable" data-density="comfortable">
  <header class="cap-panel-head"><h3>Comfortable panel</h3><span class="cap-panel-src">Roomier, with a faint shadow</span></header>
  <div class="cap-panel-body"><p>Spacing from the comfortable density tokens.</p></div>
</section>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-5)">
  <a class="cap-panel" id="p-link" href="#s-link"><div class="cap-panel-body"><p><strong>Recovery</strong></p><p>Opens the product page.</p></div></a>
  <a class="cap-panel" id="p-link-hover" href="#s-link" style="--card-lift: calc(-1 * var(--space-2)); --card-edge: 1"><div class="cap-panel-body"><p><strong>Disputes</strong></p><p>Under the pointer, lifted.</p></div></a>
</div>

API reference

Panel

PropTypeRequiredDoes
titleReactNodeThe heading. A panel with no title and nothing else for its header is a bare surface: the body alone, no header band.
level2 | 3The heading level the page's outline needs: h2 under a page h1, h3 inside a section.
countnumberHow many the panel holds, beside the heading: "12".
metaReactNodeA short line of figures beside the heading, for more than one count: "12 total · 3 active".
srcReactNodeWhere the data comes from and how fresh it is: "Cloudflare. Read 6 minutes ago".
moreReactNodeA link to the full view, at the right of the header: "All columns in Sites".
moreHrefstringThe same link from its address alone: moreLabel ("View all" by default) linking there.
moreLabelstring
readingbooleanThe panel's data is being read again: the source line shows "Reading again" with a spinner, and the panel is aria-busy, so what it shows reads as the old answer until the new one lands.
hrefstringThe whole panel is one link (a card leading somewhere): the panel is an <a>, so it may hold no other link or control.
descriptionReactNodeshadcn's CardDescription: a muted line under the heading.
actionsReactNodeControls that belong to the whole panel, placed after the title.
footerReactNodeA tinted band under the body for the panel's own actions or a link (shadcn's CardFooter).
size"sm""sm" tightens the panel's spacing (shadcn's Card size="sm").
headingIdstringThe heading's id. Given, the panel is wired to its title with aria-labelledby, which makes the section a named region (a landmark): give it to the panels a person should be able to jump to, not to all eight on a page.
refRef<HTMLElement>The panel's <section>, for focus, scrolling or measuring.
flushbooleanA list or a table that runs to the panel's edges: the body has no padding.
idstring
sectionstringThe name the anchor bar gives this panel. With an id, the bar links to the panel.
classNamestring
childrenReactNodeYes

TablePanel

PropTypeRequiredDoes
titleReactNodeYes
headingIdstringYesThe heading's id: the table's scrolling region is named by it.
isEmptybooleanYesNothing to list: the panel shows empty (an Empty) in place of the table.
emptyReactNodeYes
reflowbooleanNarrow screens stack each row into label and value pairs (the table's data-reflow).
captionReactNodeYesThe table's caption, visually hidden: the heading names the region, the caption the table.
childrenReactNodeYesThe table's thead and tbody; Table draws the region, the table and the caption.
actionsReactNodeControls that belong to the whole panel, placed after the title.
classNamestring
idstring
size"sm""sm" tightens the panel's spacing (shadcn's Card size="sm").
metaReactNodeA short line of figures beside the heading, for more than one count: "12 total · 3 active".
srcReactNodeWhere the data comes from and how fresh it is: "Cloudflare. Read 6 minutes ago".
countnumberHow many the panel holds, beside the heading: "12".
hrefstringThe whole panel is one link (a card leading somewhere): the panel is an <a>, so it may hold no other link or control.
refRef<HTMLElement>The panel's <section>, for focus, scrolling or measuring.
level2 | 3The heading level the page's outline needs: h2 under a page h1, h3 inside a section.
moreReactNodeA link to the full view, at the right of the header: "All columns in Sites".
moreHrefstringThe same link from its address alone: moreLabel ("View all" by default) linking there.
moreLabelstring
readingbooleanThe panel's data is being read again: the source line shows "Reading again" with a spinner, and the panel is aria-busy, so what it shows reads as the old answer until the new one lands.
descriptionReactNodeshadcn's CardDescription: a muted line under the heading.
footerReactNodeA tinted band under the body for the panel's own actions or a link (shadcn's CardFooter).
sectionstringThe name the anchor bar gives this panel. With an id, the bar links to the panel.

Parts and data attributes

ClassIs
.cap-panelthe root
.cap-panel-actiona part
.cap-panel-bodya part
.cap-panel-counta part
.cap-panel-desca part
.cap-panel-foota part
.cap-panel-heada part
.cap-panel-morea part
.cap-panel-pada part
.cap-panel-srca part
AttributeValues
data-flushpresent or absent
data-sizesm
StateRead from
:activethe platform
:hoverthe platform

Accessibility

KeyDoes
None of its ownA panel holds other components; their keys apply
  • The heading is a real h2 or h3, so screen reader users move between panels by heading.
  • Forced colors: the header's tint is removed, so a rule under the header keeps it apart.