Skip to content

Detail panel

A record opened from its row, in a panel from the right.

<main class="specimen-page" tabindex="-1">
  <h1>Queue</h1>
  <p>Each job's title opens its detail. The first one adds an entry to the history, so Back closes it.</p>
  <ul>
    <li><a href="#detail-job_7f3a92c1d4e0" data-cap-detail-open="job-blocked">Push the capsomer branch and open a pull request</a> <span class="cap-muted">blocked 26 minutes ago</span></li>
    <li><a href="#detail-job_1b80e4aa5c37" data-cap-detail-open="job-done">Rotate the watcher's Cloudflare token</a> <span class="cap-muted">done yesterday</span></li>
  </ul>
</main>
<dialog class="cap-dialog cap-detail" data-placement="right" data-size="md" data-cap="detail-panel" id="job-blocked" data-cap-detail-id="job_7f3a92c1d4e0" data-cap-history="detail" aria-labelledby="jb-title">
  <div class="cap-dialog-header" data-divider>
    <div class="cap-detail-heading">
      <p class="cap-detail-kind">Job, capsomer</p>
      <div class="cap-detail-titlerow">
        <h2 class="cap-dialog-title" id="jb-title">Push the capsomer branch and open a pull request</h2>
      </div>
      <p class="cap-detail-id">job_7f3a92c1d4e0</p>
    </div>
  </div>
  <div class="cap-dialog-body cap-detail-body">
    <section class="cap-detail-section" aria-labelledby="jb-first">
      <h3 class="cap-detail-section-title" id="jb-first">Do this first</h3>
      <p>The driver may not push. Run this from a terminal, then resume the job.</p>
      <pre class="cap-detail-cmd" id="jb-cmd">git -C C:\dev\capsomer push -u origin build/c-overlays</pre>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-cap-copy="jb-cmd" data-cap-copy-what="Command">Copy command</button>
        <span class="cap-detail-copied" role="status" data-cap-part="status"></span>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="jb-change">
      <h3 class="cap-detail-section-title" id="jb-change">Change it</h3>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-variant="primary">Resume</button>
        <button type="button" class="cap-btn">Release</button>
        <button type="button" class="cap-btn" data-variant="danger">Mark failed…</button>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="jb-record">
      <h3 class="cap-detail-section-title" id="jb-record">Record</h3>
      <dl class="cap-detail-record">
        <dt>Status</dt>
        <dd>Blocked, waiting on you</dd>
        <dt>Waits on</dt>
        <dd>A branch push. It cannot reach main.</dd>
        <dt>Posted by</dt>
        <dd class="cap-mono">agent:capsomer-driver</dd>
        <dt>Created</dt>
        <dd>41 minutes ago <time class="cap-muted cap-num" datetime="2026-09-30T13:32Z">Sep 30, 2026, 1:32 PM UTC</time></dd>
        <dt>Blocked, resumed</dt>
        <dd class="cap-num">1 time, 0 times</dd>
      </dl>
    </section>
    <p class="cap-detail-source">Source: live, D1 jobs row job_7f3a92c1d4e0. Read 40 seconds ago.</p>
  </div>
  <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg></button>
</dialog>
<dialog class="cap-dialog cap-detail" data-placement="right" data-size="md" data-cap="detail-panel" id="job-done" data-cap-detail-id="job_1b80e4aa5c37" aria-labelledby="jd-title">
  <div class="cap-dialog-header" data-divider>
    <div class="cap-detail-heading">
      <p class="cap-detail-kind">Job, capsid</p>
      <div class="cap-detail-titlerow">
        <h2 class="cap-dialog-title" id="jd-title">Rotate the watcher's Cloudflare token</h2>
      </div>
      <p class="cap-detail-id">job_1b80e4aa5c37</p>
    </div>
  </div>
  <div class="cap-dialog-body cap-detail-body">
    <section class="cap-detail-section" aria-labelledby="jd-record">
      <h3 class="cap-detail-section-title" id="jd-record">Record</h3>
      <dl class="cap-detail-record">
        <dt>Status</dt>
        <dd>Done</dd>
        <dt>Finished</dt>
        <dd>yesterday <time class="cap-muted cap-num" datetime="2026-09-29T21:14Z">Sep 29, 2026, 9:14 PM UTC</time></dd>
      </dl>
    </section>
    <p class="cap-detail-source">Source: live, D1 jobs row job_1b80e4aa5c37.</p>
  </div>
  <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg></button>
</dialog>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/detail-panel.css";
import { enhance } from "capsomer/behavior/detail-panel";

enhance();

Usage

<a href="#detail-job_7f3a92c1d4e0" data-cap-detail-open="job-panel">Push the capsomer branch and open a pull request</a>

<dialog class="cap-dialog cap-detail" data-cap="detail-panel" data-placement="right" data-size="md"
        id="job-panel" data-cap-detail-id="job_7f3a92c1d4e0" data-cap-history="detail" aria-labelledby="job-title">
  <div class="cap-dialog-header" data-divider>
    <div class="cap-detail-heading">
      <p class="cap-detail-kind">Job, capsomer</p>
      <div class="cap-detail-titlerow">
        <h2 class="cap-dialog-title" id="job-title">Push the capsomer branch and open a pull request</h2>
        [status pill]
      </div>
      <p class="cap-detail-id">job_7f3a92c1d4e0</p>
    </div>
  </div>
  <div class="cap-dialog-body cap-detail-body">
    <section class="cap-detail-section" aria-labelledby="job-first">
      <h3 class="cap-detail-section-title" id="job-first">Do this first</h3>
      <pre class="cap-detail-cmd" id="job-cmd">git push -u origin build/c-overlays</pre>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-cap-copy="job-cmd" data-cap-copy-what="Command">Copy command</button>
        <span class="cap-detail-copied" role="status" data-cap-part="status"></span>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="job-change">
      <h3 class="cap-detail-section-title" id="job-change">Change it</h3>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-variant="primary">Resume</button>
        <button type="button" class="cap-btn" data-variant="danger">Mark failed…</button>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="job-record">
      <h3 class="cap-detail-section-title" id="job-record">Record</h3>
      <dl class="cap-detail-record"><dt>Status</dt><dd>Blocked</dd></dl>
    </section>
    <p class="cap-detail-source">Source: live, D1 jobs row job_7f3a92c1d4e0. Read 40 seconds ago.</p>
  </div>
  <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close"><svg>…</svg></button>
</dialog>

Examples

Open: a blocked job with its command

<main class="specimen-page" tabindex="-1">
  <h1>Queue</h1>
  <p>The page behind the panel.</p>
</main>
<dialog class="cap-dialog cap-detail" data-placement="right" data-size="md" data-cap="detail-panel" id="job-open" data-cap-detail-id="job_7f3a92c1d4e0" data-specimen-open aria-labelledby="jo-title">
  <div class="cap-dialog-header" data-divider>
    <div class="cap-detail-heading">
      <p class="cap-detail-kind">Job, capsomer</p>
      <div class="cap-detail-titlerow">
        <h2 class="cap-dialog-title" id="jo-title">Push the capsomer branch and open a pull request</h2>
      </div>
      <p class="cap-detail-id">job_7f3a92c1d4e0</p>
    </div>
  </div>
  <div class="cap-dialog-body cap-detail-body">
    <section class="cap-detail-section" aria-labelledby="jo-first">
      <h3 class="cap-detail-section-title" id="jo-first">Do this first</h3>
      <p>The driver may not push. Run this from a terminal, then resume the job.</p>
      <pre class="cap-detail-cmd" id="jo-cmd">git -C C:\dev\capsomer push -u origin build/c-overlays</pre>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-cap-copy="jo-cmd" data-cap-copy-what="Command">Copy command</button>
        <span class="cap-detail-copied" role="status" data-cap-part="status"></span>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="jo-change">
      <h3 class="cap-detail-section-title" id="jo-change">Change it</h3>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-variant="primary">Resume</button>
        <button type="button" class="cap-btn">Release</button>
        <button type="button" class="cap-btn" data-variant="danger">Mark failed…</button>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="jo-record">
      <h3 class="cap-detail-section-title" id="jo-record">Record</h3>
      <dl class="cap-detail-record">
        <dt>Status</dt>
        <dd>Blocked, waiting on you</dd>
        <dt>Waits on</dt>
        <dd>A branch push. It cannot reach main.</dd>
        <dt>Posted by</dt>
        <dd class="cap-mono">agent:capsomer-driver</dd>
        <dt>Created</dt>
        <dd>41 minutes ago <time class="cap-muted cap-num" datetime="2026-09-30T13:32Z">Sep 30, 2026, 1:32 PM UTC</time></dd>
        <dt>Blocked, resumed</dt>
        <dd class="cap-num">1 time, 0 times</dd>
      </dl>
    </section>
    <section class="cap-detail-section" aria-labelledby="jo-changed">
      <h3 class="cap-detail-section-title" id="jo-changed">What changed</h3>
      <dl class="cap-detail-record">
        <dt>Status</dt>
        <dd class="cap-detail-diff"><del class="cap-mono"><span class="cap-sr-only">before: </span>queued</del><ins class="cap-mono"><span class="cap-sr-only">after: </span>blocked</ins></dd>
        <dt>Waits on</dt>
        <dd class="cap-detail-diff"><ins class="cap-mono"><span class="cap-sr-only">after: </span>a branch push</ins><span class="cap-muted">was empty</span></dd>
      </dl>
    </section>
    <p class="cap-detail-source">Source: live, D1 jobs row job_7f3a92c1d4e0. Read 40 seconds ago.</p>
  </div>
  <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg></button>
</dialog>

Comfortable density

<main class="specimen-page" tabindex="-1">
  <h1>Queue</h1>
  <p>The page behind the panel.</p>
</main>
<dialog class="cap-dialog cap-detail" data-placement="right" data-density="comfortable" data-size="md" data-cap="detail-panel" id="job-comfortable" data-cap-detail-id="job_7f3a92c1d4e0" data-specimen-open aria-labelledby="jc-title">
  <div class="cap-dialog-header" data-divider>
    <div class="cap-detail-heading">
      <p class="cap-detail-kind">Job, capsomer</p>
      <div class="cap-detail-titlerow">
        <h2 class="cap-dialog-title" id="jc-title">Push the capsomer branch and open a pull request</h2>
      </div>
      <p class="cap-detail-id">job_7f3a92c1d4e0</p>
    </div>
  </div>
  <div class="cap-dialog-body cap-detail-body">
    <section class="cap-detail-section" aria-labelledby="jc-first">
      <h3 class="cap-detail-section-title" id="jc-first">Do this first</h3>
      <p>The driver may not push. Run this from a terminal, then resume the job.</p>
      <pre class="cap-detail-cmd" id="jc-cmd">git -C C:\dev\capsomer push -u origin build/c-overlays</pre>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-cap-copy="jc-cmd" data-cap-copy-what="Command">Copy command</button>
        <span class="cap-detail-copied" role="status" data-cap-part="status"></span>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="jc-change">
      <h3 class="cap-detail-section-title" id="jc-change">Change it</h3>
      <div class="cap-detail-controls">
        <button type="button" class="cap-btn" data-variant="primary">Resume</button>
        <button type="button" class="cap-btn">Release</button>
        <button type="button" class="cap-btn" data-variant="danger">Mark failed…</button>
      </div>
    </section>
    <section class="cap-detail-section" aria-labelledby="jc-record">
      <h3 class="cap-detail-section-title" id="jc-record">Record</h3>
      <dl class="cap-detail-record">
        <dt>Status</dt>
        <dd>Blocked, waiting on you</dd>
        <dt>Waits on</dt>
        <dd>A branch push. It cannot reach main.</dd>
        <dt>Posted by</dt>
        <dd class="cap-mono">agent:capsomer-driver</dd>
        <dt>Created</dt>
        <dd>41 minutes ago <time class="cap-muted cap-num" datetime="2026-09-30T13:32Z">Sep 30, 2026, 1:32 PM UTC</time></dd>
        <dt>Blocked, resumed</dt>
        <dd class="cap-num">1 time, 0 times</dd>
      </dl>
    </section>
    <section class="cap-detail-section" aria-labelledby="jc-changed">
      <h3 class="cap-detail-section-title" id="jc-changed">What changed</h3>
      <dl class="cap-detail-record">
        <dt>Status</dt>
        <dd class="cap-detail-diff"><del class="cap-mono"><span class="cap-sr-only">before: </span>queued</del><ins class="cap-mono"><span class="cap-sr-only">after: </span>blocked</ins></dd>
        <dt>Waits on</dt>
        <dd class="cap-detail-diff"><ins class="cap-mono"><span class="cap-sr-only">after: </span>a branch push</ins><span class="cap-muted">was empty</span></dd>
      </dl>
    </section>
    <p class="cap-detail-source">Source: live, D1 jobs row job_7f3a92c1d4e0. Read 40 seconds ago.</p>
  </div>
  <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg></button>
</dialog>

Driven by the address: ?inspect=, with a plain form inside

<main class="specimen-page" id="cap-main" tabindex="-1">
  <h1>Mentions</h1>
  <ul class="specimen-rows">
    <li><a href="?inspect=mention-41" id="open-mention-41" data-cap-detail-open="mention-41">A reply from rosa.example about the annual report</a> <span class="cap-muted">waiting</span></li>
    <li><a href="?inspect=mention-42" id="open-mention-42" data-cap-detail-open="mention-42">A link from field-notes.example</a> <span class="cap-muted">approved</span></li>
  </ul>
</main>
<dialog class="cap-dialog cap-detail" data-cap="detail-panel" data-placement="right" data-size="md" id="mention-41" data-cap-detail-id="mention-41" data-cap-detail-param="inspect" aria-labelledby="mention-41-title">
  <div class="cap-dialog-header" data-divider>
    <div class="cap-detail-heading">
      <p class="cap-detail-kind">Mention, waiting</p>
      <div class="cap-detail-titlerow"><h2 class="cap-dialog-title" id="mention-41-title">A reply from rosa.example about the annual report</h2></div>
      <p class="cap-detail-id">mention-41</p>
    </div>
  </div>
  <div class="cap-dialog-body cap-detail-body">
    <form method="post" action="/admin/mentions/mention-41" class="cap-detail-section">
      <input type="hidden" name="id" value="mention-41" />
      <h3 class="cap-detail-section-title" id="m41-decide">Decide</h3>
      <label for="m41-note">Note, kept with the decision</label>
      <textarea class="cap-input" id="m41-note" name="note" rows="3"></textarea>
      <div class="cap-detail-controls">
        <button type="submit" class="cap-btn" data-variant="primary" name="intent" value="approve">Approve</button>
        <button type="submit" class="cap-btn" name="intent" value="spam">Spam</button>
      </div>
    </form>
    <section class="cap-detail-section" aria-labelledby="m41-record">
      <h3 class="cap-detail-section-title" id="m41-record">Record</h3>
      <dl class="cap-detail-record"><dt>Source</dt><dd>https://rosa.example/notes/annual-report</dd><dt>Received</dt><dd>Oct 2, 2:02 PM UTC</dd></dl>
    </section>
  </div>
  <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" d="M4 4l8 8M12 4l-8 8"/></svg></button>
</dialog>

API reference

DetailPanel

PropTypeRequiredDoes
openbooleanYes
onClose() => voidYesCalled once the panel has closed, by Esc, Close, the backdrop or Back.
idstringYesA stable identifier for the address (#detail-<id>) and the element ids.
titlestringYesThe title in plain words: "Push the capsomer branch and open a pull request".
identifierstringThe record's identifier, shown under the title: "job_7f3a92c1d4e0".
kindstringA small label above the title: "Job, capsid".
badgeReactNodeA status pill beside the title.
historybooleanPush "#detail-<id>" so Back closes the panel.
closeLabelstring
childrenReactNodeYesThe sections, in order: what to do first, the controls, the record, the source.

DetailSection

PropTypeRequiredDoes
titlestringYes
childrenReactNodeYes

DetailCommand

PropTypeRequiredDoes
textstringYes
copyLabelstring
whatstring

Functions

FunctionSignatureDoes
detailHash(dialog: HTMLDialogElement): stringThe identifier used in the address: data-cap-detail-id, or the dialog's id.
detailUrl(dialog: HTMLDialogElement, open: boolean, from?: string): stringThe address with the panel's parameter set (open) or removed (closed).
detailInUrl(dialog: HTMLDialogElement, from?: string): booleanWhether the address names this panel.
wireDetail(dialog: HTMLDialogElement): () => voidWires the shared dialog's rules (Close, the backdrop, focus back to the row, the history entry) and the Copy buttons. Returns a function that unwires it. Idempotent.
openDetail(dialog: HTMLDialogElement, opener?: Element | null, opts?: DetailOptions): voidOpens a panel from the control that asked for it (the row's link). Focus goes to the first control inside, or to Close when there is none.
closeDetail(dialog: HTMLDialogElement): void
copyFrom(button: HTMLElement, scope?: ParentNode): Promise<boolean>Copies the text of the element a Copy button names (data-cap-copy="<id>"), and says what happened in the panel's status line. Where the clipboard is refused, it selects the text and says how to copy it.
enhance(root?: ParentNode): () => voidWires every panel under root and every trigger [data-cap-detail-open="<dialog id>"]. A trigger that is a link keeps its href for a new tab; a plain click opens the panel.

Parts and data attributes

ClassIs
.cap-detail-bodyits own class
.cap-detail-cmdits own class
.cap-detail-controlsits own class
.cap-detail-copiedits own class
.cap-detail-diffits own class
.cap-detail-headingthe root
.cap-detail-idits own class
.cap-detail-kindits own class
.cap-detail-sectionits own class
.cap-detail-section-titleits own class
.cap-detail-sourceits own class
.cap-detail-titlerowits own class
AttributeValues
data-variantdanger

Accessibility

KeyDoes
Enter on a row's linkOpens the panel; focus on its first control (Close when it has none)
Tab, Shift TabMoves through the panel's controls; stays inside it
Enter or Space on the corner Close buttonCloses; focus returns to the row's link
EscCloses; focus returns to the row's link
Alt Left, or the browser's BackCloses, when the panel pushed a history entry
  • A modal dialog named by its title; the page behind is inert.
  • Each section is a section named by its heading, so a screen reader can move between them.
  • The Copy result is a role="status" line beside the button.
  • Forced colors: the panel keeps its edge.