Skip to content

Media library

A grid of file tiles with roving focus and an inspector that saves alt text, caption and tags.

  <p>Alt text written; selected (check mark and the word Selected); no alt text; decorative (a choice, not a gap); unattached; a document; uploading with its progress; failed with its reason and Retry; in Trash with Restore.</p>
  <div class="cap-media" id="tiles" data-size="m">
    <ul class="cap-media-grid" role="list" aria-label="One tile in each state">

<li class="cap-media-tile" id="t-launch-hero" data-key="media/launch-hero.jpg" data-label="launch-hero.jpg" data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="421888" data-width="1600" data-height="900" data-uploaded="2026-09-30" data-url="https://example.com/media/launch-hero.jpg" data-alt="set" data-alt-text="The status dashboard with three sites reporting healthy" data-title="Status dashboard" data-caption="Three sites, all green." data-tags="release, dashboard" data-used="2" data-used-in='[{&quot;title&quot;: &quot;Notes on the spring release&quot;, &quot;href&quot;: &quot;/admin/posts/spring-release/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;A quieter status page&quot;, &quot;href&quot;: &quot;/admin/posts/quieter-status-page/edit&quot;, &quot;how&quot;: &quot;cover&quot;}]' data-suggested-tags='["2026"]'>
  <a class="cap-media-open" aria-describedby="t-launch-hero-flags" href="?key=media%2Flaunch-hero.jpg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%238c5fd2'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23e9defa'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/launch-hero.jpg">launch-hero.jpg</span><span class="cap-media-meta">JPEG · 412 kB</span></a>
  <span class="cap-media-flags" id="t-launch-hero-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/launch-hero.jpg" aria-label="Select launch-hero.jpg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

<li class="cap-media-tile" id="t-mention-queue" data-key="media/mention-queue.png" data-label="mention-queue.png" data-state="ready" data-kind="image" data-type="image/png" data-bytes="207872" data-width="1400" data-height="900" data-uploaded="2026-08-27" data-url="https://example.com/media/mention-queue.png" data-alt="set" data-alt-text="The mention queue with four mentions waiting" data-title="" data-caption="" data-tags="mentions" data-used="3" data-used-in='[{&quot;title&quot;: &quot;What a mention queue is for&quot;, &quot;href&quot;: &quot;/admin/posts/mention-queue/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;Undo is cheaper than are-you-sure&quot;, &quot;href&quot;: &quot;/admin/posts/undo/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;Search without a server&quot;, &quot;href&quot;: &quot;/admin/posts/search/edit&quot;, &quot;how&quot;: &quot;cover&quot;}]' data-suggested-tags='[]' data-selected>
  <a class="cap-media-open" aria-describedby="t-mention-queue-flags" href="?key=media%2Fmention-queue.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23ece5ff'/%3E%3Crect x='60' y='60' width='200' height='30' fill='%234f2d7f'/%3E%3Crect x='60' y='120' width='140' height='30' fill='%234f2d7f'/%3E%3Crect x='60' y='180' width='200' height='80' fill='%234f2d7f'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/mention-queue.png">mention-queue.png</span><span class="cap-media-meta">PNG · 203 kB</span></a>
  <span class="cap-media-flags" id="t-mention-queue-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/mention-queue.png" aria-label="Select mention-queue.png" checked /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

<li class="cap-media-tile" id="t-uptime-strip" data-key="media/uptime-strip.png" data-label="uptime-strip.png" data-state="ready" data-kind="image" data-type="image/png" data-bytes="98304" data-width="1200" data-height="300" data-uploaded="2026-09-28" data-url="https://example.com/media/uptime-strip.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="1" data-used-in='[{&quot;title&quot;: &quot;Why the uptime strip counts gaps&quot;, &quot;href&quot;: &quot;/admin/posts/uptime-gaps/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}]' data-suggested-tags='["uptime"]'>
  <a class="cap-media-open" aria-describedby="t-uptime-strip-flags" href="?key=media%2Fuptime-strip.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23d8ecea'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%23008489'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/uptime-strip.png">uptime-strip.png</span><span class="cap-media-meta">PNG · 96 kB</span></a>
  <span class="cap-media-flags" id="t-uptime-strip-flags"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>No alt text</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/uptime-strip.png" aria-label="Select uptime-strip.png" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

<li class="cap-media-tile" id="t-project-tree" data-key="media/project-tree.svg" data-label="project-tree.svg" data-state="ready" data-kind="image" data-type="image/svg+xml" data-bytes="18432" data-width="800" data-height="800" data-uploaded="2026-09-25" data-url="https://example.com/media/project-tree.svg" data-alt="decorative" data-alt-text="" data-title="" data-caption="" data-tags="diagrams" data-used="1" data-used-in='[{&quot;title&quot;: &quot;Field notes: reading a project tree&quot;, &quot;href&quot;: &quot;/admin/posts/project-tree/edit&quot;, &quot;how&quot;: &quot;figure&quot;}]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="t-project-tree-flags" href="?key=media%2Fproject-tree.svg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23f7dccb'/%3E%3Cg fill='%23cc4f0c'%3E%3Ccircle cx='160' cy='70' r='28'/%3E%3Ccircle cx='90' cy='170' r='28'/%3E%3Ccircle cx='230' cy='170' r='28'/%3E%3Ccircle cx='55' cy='260' r='22'/%3E%3Ccircle cx='125' cy='260' r='22'/%3E%3C/g%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/project-tree.svg">project-tree.svg</span><span class="cap-media-meta">SVG+XML · 18 kB</span></a>
  <span class="cap-media-flags" id="t-project-tree-flags"><span class="cap-status" data-tone="info"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><rect x="1.5" y="1.5" width="13" height="13" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path fill="currentColor" d="M7.2 7h1.6v5H7.2zM7.2 4h1.6v1.7H7.2z"/></svg>Decorative</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/project-tree.svg" aria-label="Select project-tree.svg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

<li class="cap-media-tile" id="t-fieldnotes-migration" data-key="media/fieldnotes-migration.jpg" data-label="fieldnotes-migration.jpg" data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="2516582" data-width="3000" data-height="2000" data-uploaded="2026-09-22" data-url="https://example.com/media/fieldnotes-migration.jpg" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='["2026", "field notes"]'>
  <a class="cap-media-open" aria-describedby="t-fieldnotes-migration-flags" href="?key=media%2Ffieldnotes-migration.jpg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23dfe3f1'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%235b6b9a'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23dfe3f1'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/fieldnotes-migration.jpg">fieldnotes-migration.jpg</span><span class="cap-media-meta">JPEG · 2.4 MB</span></a>
  <span class="cap-media-flags" id="t-fieldnotes-migration-flags"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>No alt text</span><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>Unattached</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/fieldnotes-migration.jpg" aria-label="Select fieldnotes-migration.jpg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

<li class="cap-media-tile" id="t-uptime-report-september" data-key="media/uptime-report-september.pdf" data-label="uptime-report-september.pdf" data-state="ready" data-kind="document" data-type="application/pdf" data-bytes="1887436" data-uploaded="2026-09-20" data-url="https://example.com/media/uptime-report-september.pdf" data-alt="set" data-alt-text="" data-title="" data-caption="" data-tags="reports" data-used="1" data-used-in='[{&quot;title&quot;: &quot;What a mention queue is for&quot;, &quot;href&quot;: &quot;/admin/posts/mention-queue/edit&quot;, &quot;how&quot;: &quot;linked&quot;}]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="t-uptime-report-september-flags" href="?key=media%2Fuptime-report-september.pdf"><span class="cap-media-thumb"><span class="cap-media-doc" aria-hidden="true">PDF</span></span><span class="cap-media-name" title="media/uptime-report-september.pdf">uptime-report-september.pdf</span><span class="cap-media-meta">PDF · 1.8 MB</span></a>
  <span class="cap-media-flags" id="t-uptime-report-september-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/uptime-report-september.pdf" aria-label="Select uptime-report-september.pdf" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

<li class="cap-media-tile" id="t-capsid-walkthrough" data-key="media/capsid-walkthrough.png" data-label="capsid-walkthrough.png" data-state="uploading" data-kind="image" data-type="image/png" data-bytes="3355443" data-width="1920" data-height="1080" data-uploaded="2026-10-01" data-url="https://example.com/media/capsid-walkthrough.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='[]' data-progress="62">
  <button type="button" class="cap-media-open" aria-describedby="t-capsid-walkthrough-flags" aria-disabled="true" aria-description="PNG, uploading 62 percent"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%238c5fd2'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/capsid-walkthrough.png">capsid-walkthrough.png</span><span class="cap-media-meta">Uploading</span></button>
  <span class="cap-media-flags" id="t-capsid-walkthrough-flags"></span>
  <div class="cap-media-state"><div class="cap-meter" data-cap="meter"><span class="cap-meter-label" id="t-capsid-walkthrough-p">Uploading</span><span class="cap-meter-value">62%</span><progress class="cap-meter-bar" max="100" value="62" aria-labelledby="t-capsid-walkthrough-p" aria-valuetext="62 percent of capsid-walkthrough.png uploaded"></progress></div></div>
</li>

<li class="cap-media-tile" id="t-scan-0042" data-key="media/scan-0042.png" data-label="scan-0042.png" data-state="failed" data-kind="image" data-type="image/png" data-bytes="6291456" data-uploaded="2026-10-01" data-url="https://example.com/media/scan-0042.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='[]' data-error="The file is 6 MB and the limit is 5 MB.">
  <button type="button" class="cap-media-open" aria-describedby="t-scan-0042-flags" aria-disabled="true" aria-description="PNG, upload failed: The file is 6 MB and the limit is 5 MB."><span class="cap-media-thumb"><span class="cap-media-doc" aria-hidden="true">PNG</span></span><span class="cap-media-name" title="media/scan-0042.png">scan-0042.png</span><span class="cap-media-meta">Not uploaded</span></button>
  <span class="cap-media-flags" id="t-scan-0042-flags"></span>
  <div class="cap-media-state" data-tone="crit"><p class="cap-media-state-lead"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Upload failed</p><p class="cap-media-reason">The file is 6 MB and the limit is 5 MB.</p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry">Retry<span class="cap-sr-only"> uploading scan-0042.png</span></button></div>
</li>

<li class="cap-media-tile" id="t-old-logo" data-key="media/old-logo.png" data-label="old-logo.png" data-state="binned" data-kind="image" data-type="image/png" data-bytes="40960" data-width="512" data-height="512" data-uploaded="2026-08-02" data-url="https://example.com/media/old-logo.png" data-alt="set" data-alt-text="The previous site logo" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="t-old-logo-flags" href="?key=media%2Fold-logo.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e8e6ee'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%236b6677'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/old-logo.png">old-logo.png</span><span class="cap-media-meta">PNG · 40 kB</span></a>
  <span class="cap-media-flags" id="t-old-logo-flags"><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>In Trash</span><button type="button" class="cap-btn" data-size="xs" data-cap-part="restore" tabindex="-1">Restore<span class="cap-sr-only"> old-logo.png</span></button></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/old-logo.png" aria-label="Select old-logo.png" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>

    </ul>
    <p class="cap-media-count" role="status">9 files</p>
  </div>

Installation

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

enhance();

Usage

<li class="cap-media-tile" id="tile-launch-hero" data-key="media/launch-hero.jpg" data-label="launch-hero.jpg"
    data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="421888" data-width="1600" data-height="900"
    data-uploaded="2026-09-18" data-url="https://example.com/media/launch-hero.jpg"
    data-alt="set" data-alt-text="The status dashboard with three sites reporting healthy" data-title="" data-caption=""
    data-tags="release, dashboard" data-used="2" data-used-in='[{"title":"Notes on the spring release","href":"/admin/posts/spring-release/edit","how":"image in the body"}]'
    data-suggested-tags='["2026"]' data-active>
  <a class="cap-media-open" href="?key=media%2Flaunch-hero.jpg" aria-describedby="tile-launch-hero-flags" aria-current="true">
    <span class="cap-media-thumb"><img src="…" alt="" loading="lazy" decoding="async" width="320" height="320" /></span>
    <span class="cap-media-name" title="media/launch-hero.jpg">launch-hero.jpg</span>
    <span class="cap-media-meta">JPEG · 412 kB</span>
  </a>
  <span class="cap-media-flags" id="tile-launch-hero-flags"><span class="cap-status" data-tone="warn">[warning glyph]No alt text</span></span>
  <label class="cap-media-check">
    <input type="checkbox" data-cap-select value="media/launch-hero.jpg" aria-label="Select launch-hero.jpg" />
    <span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16">…</svg></span>
    <span class="cap-media-check-word" aria-hidden="true">Selected</span>
  </label>
</li>
<div class="cap-media" data-cap="media" data-size="m">        <!-- data-size="s|m|l" -->
  <div class="cap-media-layout">
    <div class="cap-media-main">
      <div class="cap-media-toolbar">
        <div class="cap-field cap-media-search"><label class="cap-sr-only" for="q">Search files</label><input class="cap-input" type="search" id="q" data-cap-part="search" /></div>
        <div class="cap-chips" data-cap="chips" data-cap-part="filters" role="group" aria-labelledby="f-l">…
          <button class="cap-chip" aria-pressed="false" data-value="unattached">Unattached <span class="cap-chip-count">3</span></button> <!-- unattached, no-alt, large --></div>
        <fieldset class="cap-seg" data-cap-part="view">…radios "library" and "bin", with <span data-cap-count="library"> and "bin"…</fieldset>
        <fieldset class="cap-seg" data-cap-part="sort">…radios "added" (Newest), "name" (A to Z), "size" (Largest)…</fieldset>
        <fieldset class="cap-seg" data-cap-part="layout">…radios "grid" and "list" (sets data-view on the container)…</fieldset>
        <fieldset class="cap-seg" data-cap-part="size">…radios s, m, l (sets data-size on the container)…</fieldset>
      </div>
      <div class="cap-bulk" data-cap="bulk-bar" data-cap-list="tiles" role="region" aria-label="Bulk actions" hidden>…</div>
      <p class="cap-media-count" role="status">24 files</p>
      <div id="tiles">
        <section class="cap-media-group" aria-labelledby="g1"><h2 class="cap-media-group-title" id="g1">September 2026 <span class="cap-media-group-count">6 on this page</span></h2>
          <ul class="cap-media-grid" role="list" aria-label="Files, September 2026">…tiles…</ul></section>
      </div>
      <div class="cap-media-empty" hidden>…one .cap-empty per cause, each with data-cap-empty="search|filter|library|bin" and hidden…</div>
    </div>
    <dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="ins" aria-labelledby="ins-title" open>
      <div class="cap-dialog-header" data-divider><h2 class="cap-dialog-title cap-media-title" id="ins-title" data-cap-part="title">launch-hero.jpg</h2><p class="cap-dialog-description" data-cap-part="subtitle">JPEG · 412 kB · 1600 by 900</p></div>
      <form class="cap-dialog-body cap-media-form" method="post" action="/admin/media/save" data-cap-part="form">
        <input type="hidden" name="key" value="media/launch-hero.jpg" data-cap-part="key" />
        <div class="cap-media-preview"><img data-cap-part="preview" src="…" alt="" width="640" height="427" /></div>
        <div class="cap-field" data-cap-part="alt-field"><label class="cap-field-label" for="ins-alt">Alt text</label><textarea class="cap-input" id="ins-alt" name="alt" rows="2" data-cap-part="alt">…</textarea><p class="cap-field-help" id="ins-alt-help">…</p></div>
        <div class="cap-field" data-cap-part="decorative-field"><label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" /> Decorative image</label>…</div>
        <!-- Title (data-cap-part="title-field"), Caption (data-cap-part="caption"), Tags: ul data-cap-part="tags" of .cap-chip buttons (data-cap-tag), hidden input data-cap-part="tags-value", input data-cap-part="tag-input", ul data-cap-part="suggestions" -->
        <!-- Address: input data-cap-part="address"; copy buttons data-cap-copy-kind="address|markdown|html"; p role="status" data-cap-part="copied" -->
        <!-- Facts: dl data-cap-part="facts". Used in: div data-cap-part="used" holding ul.cap-media-used, or the not-used note -->
        <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>  <!-- hidden once the behavior is attached -->
      </form>
      <div class="cap-dialog-footer">
        <div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div>
        <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button><button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
      </div>
      <button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only data-cap-part="close" aria-label="Close">…</button>
    </dialog>
  </div>
</div>
import { attachMedia, enhance } from "capsomer/behavior/media";
const media = attachMedia(el, {
  save: (key, fields) => api.saveMedia(key, fields), // { alt, decorative, title, caption, tags }; reject with an Error that says why
  bin: (keys) => api.bin(keys), restore: (keys) => api.restore(keys), retry: (key) => api.retryUpload(key),
});
bindBulk(bulkBar, media.bulkHandlers()); // bin, restore, copy, add-tag, remove-tag
media.add({ key, name, url, kind: "image", type: file.type, bytes: file.size, alt: "", altState: "missing", title: "", caption: "", tags: [], used: [], state: "uploading", progress: 0 });
media.update(key, { progress: 60 }); media.update(key, { state: "ready" }); media.update(key, { state: "failed", error: "The file is 6 MB and the limit is 5 MB." });
import { MediaGrid, MediaInspector, MediaTile, useMediaMode } from "capsomer/react/media";
<MediaGrid groups={[{ label: "September 2026", items }]} activeKey={key} onActiveChange={setKey} onOpen={open}
  selected={selected} onSelectedChange={setSelected} inspecting={inspecting} onRetry={retry} onRestore={restore} />
<MediaInspector item={active} open={inspecting} mode={useMediaMode(layoutRef)} onSave={save} onClose={close}
  onBin={bin} onRestore={restore} onShowUnattached={showUnattached} onStep={(dir) => step(dir)} />

Examples

The inspector saves by itself: its status

  <p>Idle, unsaved changes, saving, saved, and could not save with Retry. Each is a word and a shape.</p>
  <div class="media-save-rows">

<div class="media-save-row" id="save-idle"><div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div></div>

<div class="media-save-row" id="save-dirty"><div class="cap-media-save" data-cap-part="save" data-state="dirty"><p role="status" data-cap-part="save-status"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><rect x="1.5" y="1.5" width="13" height="13" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path fill="currentColor" d="M7.2 7h1.6v5H7.2zM7.2 4h1.6v1.7H7.2z"/></svg>Unsaved changes</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div></div>

<div class="media-save-row" id="save-saving"><div class="cap-media-save" data-cap-part="save" data-state="saving"><p role="status" data-cap-part="save-status"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6" opacity="0.35"/><path fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" d="M8 1.8a6.2 6.2 0 0 1 6.2 6.2"/></svg>Saving…</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div></div>

<div class="media-save-row" id="save-saved"><div class="cap-media-save" data-cap-part="save" data-state="saved"><p role="status" data-cap-part="save-status"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1a7 7 0 1 0 0 14A7 7 0 1 0 8 1zM3.9 9l3 3 5.2-5.6-1.4-1.4-3.8 4.2-1.6-1.6z"/></svg>Saved</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div></div>

<div class="media-save-row" id="save-failed"><div class="cap-media-save" data-cap-part="save" data-state="failed"><p role="status" data-cap-part="save-status"></p><p role="alert" data-cap-part="save-error"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Could not save: The server answered 502. What you typed is still here.</p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save">Retry</button></div></div>

  </div>

The inspector, as the server renders it

  <p>Open, not modal, with the active file's details in the HTML: alt text, decorative, title, caption, tags, address, used in. With script it follows the active tile and saves by itself.</p>
  <div class="cap-media" id="ins-static"><div class="cap-media-layout">

<dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="ins-static-ins" aria-labelledby="ins-static-ins-title" open>
  <div class="cap-dialog-header" data-divider>
    <h2 class="cap-dialog-title cap-media-title" id="ins-static-ins-title" data-cap-part="title">uptime-strip.png</h2>
    <p class="cap-dialog-description" data-cap-part="subtitle">PNG · 96 kB · 1200 by 300</p>
  </div>
  <form class="cap-dialog-body cap-media-form" id="ins-static-ins-form" method="post" action="/admin/media/save" data-cap-part="form">
    <input type="hidden" name="key" value="media/uptime-strip.png" data-cap-part="key" />
    <div class="cap-media-preview"><img data-cap-part="preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23d8ecea'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%23008489'/%3E%3C/svg%3E" alt="" width="640" height="427" /></div>
    <div class="cap-field" data-cap-part="alt-field">
      <label class="cap-field-label" for="ins-static-ins-alt">Alt text</label>
      <textarea class="cap-input" id="ins-static-ins-alt" name="alt" rows="2" data-cap-part="alt" aria-describedby="ins-static-ins-alt-help" placeholder="Describe what the picture shows"></textarea>
      <p class="cap-field-help" id="ins-static-ins-alt-help">What a person who cannot see the picture needs to know. Leave out “image of”.</p>
    </div>
    <div class="cap-field" data-cap-part="decorative-field">
      <label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" aria-describedby="ins-static-ins-deco-help" /> Decorative image</label>
      <p class="cap-field-help" id="ins-static-ins-deco-help">It adds nothing a reader needs, so a screen reader skips it. This is a choice, not a missing description.</p>
    </div>
    <p class="cap-field-help" data-cap-part="alt-document" hidden>A document takes no alt text. What a reader hears is the link text, and that lives in the post.</p>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-static-ins-title-field">Title</label>
      <input class="cap-input" id="ins-static-ins-title-field" name="title" type="text" autocomplete="off" data-cap-part="title-field" value="" />
    </div>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-static-ins-caption">Caption</label>
      <textarea class="cap-input" id="ins-static-ins-caption" name="caption" rows="2" data-cap-part="caption"></textarea>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-static-ins-tags-l">
      <span class="cap-field-label" id="ins-static-ins-tags-l">Tags</span>
      <ul class="cap-media-tags" data-cap-part="tags"></ul>
      <input type="hidden" name="tags" value="" data-cap-part="tags-value" />
      <label class="cap-sr-only" for="ins-static-ins-tag-input">Add a tag</label>
      <input class="cap-input" id="ins-static-ins-tag-input" type="text" autocomplete="off" placeholder="Add a tag, then press Enter" data-cap-part="tag-input" />
      <ul class="cap-media-tags" data-cap-part="suggestions"><li><button type="button" class="cap-chip" data-cap-suggest="uptime" aria-label="Add suggested tag uptime">+ uptime</button></li></ul>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-static-ins-addr-l">
      <label class="cap-field-label" id="ins-static-ins-addr-l" for="ins-static-ins-addr">Address</label>
      <input class="cap-input" id="ins-static-ins-addr" readonly value="https://example.com/media/uptime-strip.png" data-cap-part="address" />
      <div class="cap-media-copy"><button type="button" class="cap-btn" data-size="sm" data-cap-copy="https://example.com/media/uptime-strip.png" data-cap-copy-kind="address" aria-label="Copy address"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><span data-cap-part="copy-label">Copy address</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="![](https://example.com/media/uptime-strip.png)" data-cap-copy-kind="markdown" aria-label="Copy the Markdown image"><span data-cap-part="copy-label">Markdown</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="&lt;img src=&quot;https://example.com/media/uptime-strip.png&quot; alt=&quot;&quot;&gt;" data-cap-copy-kind="html" aria-label="Copy the HTML tag"><span data-cap-part="copy-label">HTML tag</span></button></div>
      <p class="cap-media-copied" role="status" data-cap-part="copied"></p>
    </div>
    <dl class="cap-media-facts" data-cap-part="facts"><dt>Key</dt><dd>media/uptime-strip.png</dd><dt>Type</dt><dd>image/png</dd><dt>Size</dt><dd>96 kB</dd><dt>Dimensions</dt><dd>1200 by 300</dd><dt>Uploaded</dt><dd>2026-09-28</dd></dl>
    <section class="cap-media-section" aria-labelledby="ins-static-ins-used-l">
      <h3 id="ins-static-ins-used-l">Used in</h3>
      <div data-cap-part="used"><ul class="cap-media-used"><li><a href="/admin/posts/uptime-gaps/edit">Why the uptime strip counts gaps</a><span class="cap-media-used-how">image in the body</span></li></ul></div>
    </section>
    <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>
  </form>
  <div class="cap-dialog-footer">
    <div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div>
    <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button>
    <button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
  </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>

</div></div>

Not used anywhere, and decorative

  <div class="cap-media"><div class="cap-media-layout">

<dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="ins-unused" aria-labelledby="ins-unused-title" open>
  <div class="cap-dialog-header" data-divider>
    <h2 class="cap-dialog-title cap-media-title" id="ins-unused-title" data-cap-part="title">fieldnotes-migration.jpg</h2>
    <p class="cap-dialog-description" data-cap-part="subtitle">JPEG · 2.4 MB · 3000 by 2000</p>
  </div>
  <form class="cap-dialog-body cap-media-form" id="ins-unused-form" method="post" action="/admin/media/save" data-cap-part="form">
    <input type="hidden" name="key" value="media/fieldnotes-migration.jpg" data-cap-part="key" />
    <div class="cap-media-preview"><img data-cap-part="preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23dfe3f1'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%235b6b9a'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23dfe3f1'/%3E%3C/svg%3E" alt="" width="640" height="427" /></div>
    <div class="cap-field" data-cap-part="alt-field">
      <label class="cap-field-label" for="ins-unused-alt">Alt text</label>
      <textarea class="cap-input" id="ins-unused-alt" name="alt" rows="2" data-cap-part="alt" aria-describedby="ins-unused-alt-help" placeholder="Describe what the picture shows"></textarea>
      <p class="cap-field-help" id="ins-unused-alt-help">What a person who cannot see the picture needs to know. Leave out “image of”.</p>
    </div>
    <div class="cap-field" data-cap-part="decorative-field">
      <label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" aria-describedby="ins-unused-deco-help" /> Decorative image</label>
      <p class="cap-field-help" id="ins-unused-deco-help">It adds nothing a reader needs, so a screen reader skips it. This is a choice, not a missing description.</p>
    </div>
    <p class="cap-field-help" data-cap-part="alt-document" hidden>A document takes no alt text. What a reader hears is the link text, and that lives in the post.</p>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-unused-title-field">Title</label>
      <input class="cap-input" id="ins-unused-title-field" name="title" type="text" autocomplete="off" data-cap-part="title-field" value="" />
    </div>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-unused-caption">Caption</label>
      <textarea class="cap-input" id="ins-unused-caption" name="caption" rows="2" data-cap-part="caption"></textarea>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-unused-tags-l">
      <span class="cap-field-label" id="ins-unused-tags-l">Tags</span>
      <ul class="cap-media-tags" data-cap-part="tags"></ul>
      <input type="hidden" name="tags" value="" data-cap-part="tags-value" />
      <label class="cap-sr-only" for="ins-unused-tag-input">Add a tag</label>
      <input class="cap-input" id="ins-unused-tag-input" type="text" autocomplete="off" placeholder="Add a tag, then press Enter" data-cap-part="tag-input" />
      <ul class="cap-media-tags" data-cap-part="suggestions"><li><button type="button" class="cap-chip" data-cap-suggest="2026" aria-label="Add suggested tag 2026">+ 2026</button></li><li><button type="button" class="cap-chip" data-cap-suggest="field notes" aria-label="Add suggested tag field notes">+ field notes</button></li></ul>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-unused-addr-l">
      <label class="cap-field-label" id="ins-unused-addr-l" for="ins-unused-addr">Address</label>
      <input class="cap-input" id="ins-unused-addr" readonly value="https://example.com/media/fieldnotes-migration.jpg" data-cap-part="address" />
      <div class="cap-media-copy"><button type="button" class="cap-btn" data-size="sm" data-cap-copy="https://example.com/media/fieldnotes-migration.jpg" data-cap-copy-kind="address" aria-label="Copy address"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><span data-cap-part="copy-label">Copy address</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="![](https://example.com/media/fieldnotes-migration.jpg)" data-cap-copy-kind="markdown" aria-label="Copy the Markdown image"><span data-cap-part="copy-label">Markdown</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="&lt;img src=&quot;https://example.com/media/fieldnotes-migration.jpg&quot; alt=&quot;&quot;&gt;" data-cap-copy-kind="html" aria-label="Copy the HTML tag"><span data-cap-part="copy-label">HTML tag</span></button></div>
      <p class="cap-media-copied" role="status" data-cap-part="copied"></p>
    </div>
    <dl class="cap-media-facts" data-cap-part="facts"><dt>Key</dt><dd>media/fieldnotes-migration.jpg</dd><dt>Type</dt><dd>image/jpeg</dd><dt>Size</dt><dd>2.4 MB</dd><dt>Dimensions</dt><dd>3000 by 2000</dd><dt>Uploaded</dt><dd>2026-09-22</dd></dl>
    <section class="cap-media-section" aria-labelledby="ins-unused-used-l">
      <h3 id="ins-unused-used-l">Used in</h3>
      <div data-cap-part="used"><p class="cap-media-used-empty">Not used anywhere.</p><p class="cap-media-note">No post cites this file. That is not proof it is unused: a page built in code can still use it, so check before you delete it. The Unattached filter lists every file like this. <button type="button" class="cap-btn" data-variant="link" data-cap-part="show-unattached">Show unattached files</button></p></div>
    </section>
    <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>
  </form>
  <div class="cap-dialog-footer">
    <div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div>
    <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button>
    <button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
  </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>

</div></div>

Marked decorative: the alt field is cleared and disabled

  <div class="cap-media"><div class="cap-media-layout">

<dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="ins-deco" aria-labelledby="ins-deco-title" open>
  <div class="cap-dialog-header" data-divider>
    <h2 class="cap-dialog-title cap-media-title" id="ins-deco-title" data-cap-part="title">project-tree.svg</h2>
    <p class="cap-dialog-description" data-cap-part="subtitle">SVG+XML · 18 kB · 800 by 800</p>
  </div>
  <form class="cap-dialog-body cap-media-form" id="ins-deco-form" method="post" action="/admin/media/save" data-cap-part="form">
    <input type="hidden" name="key" value="media/project-tree.svg" data-cap-part="key" />
    <div class="cap-media-preview"><img data-cap-part="preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23f7dccb'/%3E%3Cg fill='%23cc4f0c'%3E%3Ccircle cx='160' cy='70' r='28'/%3E%3Ccircle cx='90' cy='170' r='28'/%3E%3Ccircle cx='230' cy='170' r='28'/%3E%3Ccircle cx='55' cy='260' r='22'/%3E%3Ccircle cx='125' cy='260' r='22'/%3E%3C/g%3E%3C/svg%3E" alt="" width="640" height="427" /></div>
    <div class="cap-field" data-cap-part="alt-field">
      <label class="cap-field-label" for="ins-deco-alt">Alt text</label>
      <textarea class="cap-input" id="ins-deco-alt" name="alt" rows="2" data-cap-part="alt" aria-describedby="ins-deco-alt-help" placeholder="Describe what the picture shows" disabled></textarea>
      <p class="cap-field-help" id="ins-deco-alt-help">What a person who cannot see the picture needs to know. Leave out “image of”.</p>
    </div>
    <div class="cap-field" data-cap-part="decorative-field">
      <label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" aria-describedby="ins-deco-deco-help" checked /> Decorative image</label>
      <p class="cap-field-help" id="ins-deco-deco-help">It adds nothing a reader needs, so a screen reader skips it. This is a choice, not a missing description.</p>
    </div>
    <p class="cap-field-help" data-cap-part="alt-document" hidden>A document takes no alt text. What a reader hears is the link text, and that lives in the post.</p>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-deco-title-field">Title</label>
      <input class="cap-input" id="ins-deco-title-field" name="title" type="text" autocomplete="off" data-cap-part="title-field" value="" />
    </div>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-deco-caption">Caption</label>
      <textarea class="cap-input" id="ins-deco-caption" name="caption" rows="2" data-cap-part="caption"></textarea>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-deco-tags-l">
      <span class="cap-field-label" id="ins-deco-tags-l">Tags</span>
      <ul class="cap-media-tags" data-cap-part="tags"><li><button type="button" class="cap-chip" data-cap-tag="diagrams" aria-label="Remove tag diagrams">diagrams <span aria-hidden="true">×</span></button></li></ul>
      <input type="hidden" name="tags" value="diagrams" data-cap-part="tags-value" />
      <label class="cap-sr-only" for="ins-deco-tag-input">Add a tag</label>
      <input class="cap-input" id="ins-deco-tag-input" type="text" autocomplete="off" placeholder="Add a tag, then press Enter" data-cap-part="tag-input" />
      <ul class="cap-media-tags" data-cap-part="suggestions"></ul>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-deco-addr-l">
      <label class="cap-field-label" id="ins-deco-addr-l" for="ins-deco-addr">Address</label>
      <input class="cap-input" id="ins-deco-addr" readonly value="https://example.com/media/project-tree.svg" data-cap-part="address" />
      <div class="cap-media-copy"><button type="button" class="cap-btn" data-size="sm" data-cap-copy="https://example.com/media/project-tree.svg" data-cap-copy-kind="address" aria-label="Copy address"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><span data-cap-part="copy-label">Copy address</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="![](https://example.com/media/project-tree.svg)" data-cap-copy-kind="markdown" aria-label="Copy the Markdown image"><span data-cap-part="copy-label">Markdown</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="&lt;img src=&quot;https://example.com/media/project-tree.svg&quot; alt=&quot;&quot;&gt;" data-cap-copy-kind="html" aria-label="Copy the HTML tag"><span data-cap-part="copy-label">HTML tag</span></button></div>
      <p class="cap-media-copied" role="status" data-cap-part="copied"></p>
    </div>
    <dl class="cap-media-facts" data-cap-part="facts"><dt>Key</dt><dd>media/project-tree.svg</dd><dt>Type</dt><dd>image/svg+xml</dd><dt>Size</dt><dd>18 kB</dd><dt>Dimensions</dt><dd>800 by 800</dd><dt>Uploaded</dt><dd>2026-09-25</dd></dl>
    <section class="cap-media-section" aria-labelledby="ins-deco-used-l">
      <h3 id="ins-deco-used-l">Used in</h3>
      <div data-cap-part="used"><ul class="cap-media-used"><li><a href="/admin/posts/project-tree/edit">Field notes: reading a project tree</a><span class="cap-media-used-how">figure</span></li></ul></div>
    </section>
    <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>
  </form>
  <div class="cap-dialog-footer">
    <div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div>
    <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button>
    <button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
  </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>

</div></div>

A save that failed: what was typed stays

  <div class="cap-media"><div class="cap-media-layout">

<dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="ins-failed" aria-labelledby="ins-failed-title" open>
  <div class="cap-dialog-header" data-divider>
    <h2 class="cap-dialog-title cap-media-title" id="ins-failed-title" data-cap-part="title">uptime-strip.png</h2>
    <p class="cap-dialog-description" data-cap-part="subtitle">PNG · 96 kB · 1200 by 300</p>
  </div>
  <form class="cap-dialog-body cap-media-form" id="ins-failed-form" method="post" action="/admin/media/save" data-cap-part="form">
    <input type="hidden" name="key" value="media/uptime-strip.png" data-cap-part="key" />
    <div class="cap-media-preview"><img data-cap-part="preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23d8ecea'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%23008489'/%3E%3C/svg%3E" alt="" width="640" height="427" /></div>
    <div class="cap-field" data-cap-part="alt-field">
      <label class="cap-field-label" for="ins-failed-alt">Alt text</label>
      <textarea class="cap-input" id="ins-failed-alt" name="alt" rows="2" data-cap-part="alt" aria-describedby="ins-failed-alt-help" placeholder="Describe what the picture shows">The uptime strip: 29 green days and one amber</textarea>
      <p class="cap-field-help" id="ins-failed-alt-help">What a person who cannot see the picture needs to know. Leave out “image of”.</p>
    </div>
    <div class="cap-field" data-cap-part="decorative-field">
      <label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" aria-describedby="ins-failed-deco-help" /> Decorative image</label>
      <p class="cap-field-help" id="ins-failed-deco-help">It adds nothing a reader needs, so a screen reader skips it. This is a choice, not a missing description.</p>
    </div>
    <p class="cap-field-help" data-cap-part="alt-document" hidden>A document takes no alt text. What a reader hears is the link text, and that lives in the post.</p>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-failed-title-field">Title</label>
      <input class="cap-input" id="ins-failed-title-field" name="title" type="text" autocomplete="off" data-cap-part="title-field" value="" />
    </div>
    <div class="cap-field">
      <label class="cap-field-label" for="ins-failed-caption">Caption</label>
      <textarea class="cap-input" id="ins-failed-caption" name="caption" rows="2" data-cap-part="caption"></textarea>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-failed-tags-l">
      <span class="cap-field-label" id="ins-failed-tags-l">Tags</span>
      <ul class="cap-media-tags" data-cap-part="tags"></ul>
      <input type="hidden" name="tags" value="" data-cap-part="tags-value" />
      <label class="cap-sr-only" for="ins-failed-tag-input">Add a tag</label>
      <input class="cap-input" id="ins-failed-tag-input" type="text" autocomplete="off" placeholder="Add a tag, then press Enter" data-cap-part="tag-input" />
      <ul class="cap-media-tags" data-cap-part="suggestions"><li><button type="button" class="cap-chip" data-cap-suggest="uptime" aria-label="Add suggested tag uptime">+ uptime</button></li></ul>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="ins-failed-addr-l">
      <label class="cap-field-label" id="ins-failed-addr-l" for="ins-failed-addr">Address</label>
      <input class="cap-input" id="ins-failed-addr" readonly value="https://example.com/media/uptime-strip.png" data-cap-part="address" />
      <div class="cap-media-copy"><button type="button" class="cap-btn" data-size="sm" data-cap-copy="https://example.com/media/uptime-strip.png" data-cap-copy-kind="address" aria-label="Copy address"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><span data-cap-part="copy-label">Copy address</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="![The uptime strip: 29 green days and one amber](https://example.com/media/uptime-strip.png)" data-cap-copy-kind="markdown" aria-label="Copy the Markdown image"><span data-cap-part="copy-label">Markdown</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="&lt;img src=&quot;https://example.com/media/uptime-strip.png&quot; alt=&quot;The uptime strip: 29 green days and one amber&quot;&gt;" data-cap-copy-kind="html" aria-label="Copy the HTML tag"><span data-cap-part="copy-label">HTML tag</span></button></div>
      <p class="cap-media-copied" role="status" data-cap-part="copied"></p>
    </div>
    <dl class="cap-media-facts" data-cap-part="facts"><dt>Key</dt><dd>media/uptime-strip.png</dd><dt>Type</dt><dd>image/png</dd><dt>Size</dt><dd>96 kB</dd><dt>Dimensions</dt><dd>1200 by 300</dd><dt>Uploaded</dt><dd>2026-09-28</dd></dl>
    <section class="cap-media-section" aria-labelledby="ins-failed-used-l">
      <h3 id="ins-failed-used-l">Used in</h3>
      <div data-cap-part="used"><ul class="cap-media-used"><li><a href="/admin/posts/uptime-gaps/edit">Why the uptime strip counts gaps</a><span class="cap-media-used-how">image in the body</span></li></ul></div>
    </section>
    <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>
  </form>
  <div class="cap-dialog-footer">
    <div class="cap-media-save" data-cap-part="save" data-state="failed"><p role="status" data-cap-part="save-status"></p><p role="alert" data-cap-part="save-error"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Could not save: The server answered 502. What you typed is still here.</p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save">Retry</button></div>
    <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button>
    <button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
  </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>

</div></div>

An empty library

<div class="cap-empty" data-kind="nothing-yet" id="empty-library">
  <div class="cap-empty-header"><p class="cap-empty-title">Nothing here yet</p><p class="cap-empty-text">Files you upload get an address you can paste into any post.</p></div>
  <div class="cap-empty-content"><div class="cap-drop" data-cap="drop-zone" data-max-bytes="5242880" data-max-files="10" id="e-drop">
  <label class="cap-drop-label">
    <input class="cap-drop-input" type="file" multiple accept="image/*,.pdf" data-cap-part="input" aria-labelledby="e-drop-title" aria-describedby="e-drop-hint" />
    <span class="cap-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4m0 0L7 9m5-5 5 5M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" /></svg></span>
    <span class="cap-drop-title" id="e-drop-title"><span class="cap-drop-idle">Drop files here, or <span class="cap-drop-browse">browse</span></span><span class="cap-drop-over">Drop to upload</span></span>
    <span class="cap-drop-hint" id="e-drop-hint">Images and PDF, up to 5 MB each, up to 10 at a time.</span>
  </label>
  <div class="cap-drop-status" role="status" data-cap-part="status"></div>
  <div class="cap-drop-rejections" role="alert" data-cap-part="rejections"></div>
</div></div>
</div>

Nothing matches, nothing in this view, Trash is empty

<div class="cap-empty" data-kind="no-match" data-flush id="empty-search">
  <div class="cap-empty-header"><p class="cap-empty-title">No files match “fieldnotes”</p><p class="cap-empty-text">Searched names, alt text, captions and tags.</p></div>
  <div class="cap-empty-content"><button type="button" class="cap-btn">Clear the search</button></div>
</div>
<div class="cap-empty" data-kind="no-match" data-flush id="empty-filter">
  <div class="cap-empty-header"><p class="cap-empty-title">Nothing in this view</p><p class="cap-empty-text">Every file passes these checks.</p></div>
  <div class="cap-empty-content"><button type="button" class="cap-btn">Show everything</button></div>
</div>
<div class="cap-empty" data-kind="all-clear" id="empty-bin">
  <div class="cap-empty-header"><p class="cap-empty-title">Trash is empty</p><p class="cap-empty-text">A file you move to Trash keeps its address, and waits here until you restore it.</p></div>
</div>

The library: grid, filters, bulk bar and inspector

  <main>

<div class="cap-media" data-cap="media" id="library">
  <div class="cap-media-layout">
    <div class="cap-media-main">
      <div class="cap-drop" data-cap="drop-zone" data-scope="page" data-paste data-max-bytes="5242880" data-max-files="10" id="library-drop">
  <label class="cap-drop-label">
    <input class="cap-drop-input" type="file" multiple accept="image/*,.pdf" data-cap-part="input" aria-labelledby="library-drop-title" aria-describedby="library-drop-hint" />
    <span class="cap-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4m0 0L7 9m5-5 5 5M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" /></svg></span>
    <span class="cap-drop-title" id="library-drop-title"><span class="cap-drop-idle">Drop files anywhere on this page, or <span class="cap-drop-browse">browse</span></span><span class="cap-drop-over">Drop to upload</span></span>
    <span class="cap-drop-hint" id="library-drop-hint">Images and PDF, up to 5 MB each, up to 10 at a time.</span>
  </label>
  <div class="cap-drop-status" role="status" data-cap-part="status"></div>
  <div class="cap-drop-rejections" role="alert" data-cap-part="rejections"></div>
  <div class="cap-drop-overlay" aria-hidden="true"><div><p class="cap-drop-overlay-title">Drop to upload</p><p class="cap-drop-overlay-text">Release anywhere on this page to add the files.</p></div></div>
</div>
      <div class="cap-media-toolbar">
  <div class="cap-field cap-media-search">
    <label class="cap-sr-only" for="library-q">Search files</label>
    <input class="cap-input" type="search" id="library-q" data-cap-part="search" placeholder="Search 6 files" autocomplete="off" />
  </div>
  <div class="cap-chips" data-cap="chips" data-cap-part="filters" role="group" aria-labelledby="library-f-l">
    <span class="cap-chips-label" id="library-f-l">Show</span>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="unattached">Unattached <span class="cap-chip-count">1</span></button>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="no-alt">No alt text <span class="cap-chip-count">2</span></button>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="large">Over 1 MB <span class="cap-chip-count">2</span></button>
    <button type="button" class="cap-link-btn" data-cap-part="clear" hidden>Clear</button>
  </div>
  <fieldset class="cap-seg" data-cap-part="view">
    <legend class="cap-sr-only">Show files from</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="library-view" value="library" checked /> Library <span data-cap-count="library">6</span></label>
      <label><input type="radio" name="library-view" value="bin" /> Trash <span data-cap-count="bin">1</span></label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="sort">
    <legend class="cap-sr-only">Sort by</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="library-sort" value="added" checked /> Newest</label>
      <label><input type="radio" name="library-sort" value="name" /> A to Z</label>
      <label><input type="radio" name="library-sort" value="size" /> Largest</label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="layout">
    <legend class="cap-sr-only">Layout</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="library-layout" value="grid" checked /> Grid</label>
      <label><input type="radio" name="library-layout" value="list" /> List</label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="size">
    <legend class="cap-sr-only">Tile size</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="library-size" value="s" /> S</label>
      <label><input type="radio" name="library-size" value="m" checked /> M</label>
      <label><input type="radio" name="library-size" value="l" /> L</label>
    </div>
  </fieldset>
</div>
      <div class="cap-bulk" data-cap="bulk-bar" data-cap-list="library-tiles" role="region" aria-label="Bulk actions" id="library-bulk" hidden>
  <p class="cap-bulk-count" role="status"></p>
  <button type="button" class="cap-btn" data-variant="quiet" data-cap-part="select-all" data-cap-label="Select all {n} in view">Select all in view</button>
  <div class="cap-bulk-actions">
    <button type="button" class="cap-btn" data-cap-bulk-action="copy" data-cap-label="Copy">Copy addresses</button>
    <span class="cap-bulk-field"><label for="library-bulk-tag">Tag</label><input class="cap-input" id="library-bulk-tag" autocomplete="off" placeholder="tag name" /></span>
    <button type="button" class="cap-btn" data-cap-bulk-action="add-tag" data-cap-value="#library-bulk-tag" data-cap-label="Add tag">Add tag</button>
    <button type="button" class="cap-btn" data-cap-bulk-action="remove-tag" data-cap-value="#library-bulk-tag" data-cap-label="Remove tag">Remove tag</button>
    <button type="button" class="cap-btn" data-cap-bulk-action="bin" data-cap-label="Trash">Move to Trash</button>
    <button type="button" class="cap-btn" data-variant="danger" data-cap-bulk-action="delete" data-destructive data-cap-label="Delete" data-cap-confirm-title="Delete {n} file{s} for good?" data-cap-confirm-lead="A deleted file cannot be brought back by uploading it again: its address is a hash of its content." data-cap-confirm-action="Delete {n} file{s}">Delete for good</button>
  </div>
  <button type="button" class="cap-btn cap-bulk-clear" data-variant="quiet" data-cap-part="clear-bar">Clear selection</button>
</div>
      <p class="cap-media-count" role="status">6 files</p>
      <div id="library-tiles">
<section class="cap-media-group" aria-labelledby="library-g-september"><h2 class="cap-media-group-title" id="library-g-september">September 2026 <span class="cap-media-group-count">7 on this page</span></h2>
<ul class="cap-media-grid" role="list" aria-label="Files, September 2026">
<li class="cap-media-tile" id="library-capsid-walkthrough" data-key="media/capsid-walkthrough.png" data-label="capsid-walkthrough.png" data-state="uploading" data-kind="image" data-type="image/png" data-bytes="3355443" data-width="1920" data-height="1080" data-uploaded="2026-10-01" data-url="https://example.com/media/capsid-walkthrough.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='[]' data-progress="62">
  <button type="button" class="cap-media-open" aria-describedby="library-capsid-walkthrough-flags" aria-disabled="true" aria-description="PNG, uploading 62 percent"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%238c5fd2'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/capsid-walkthrough.png">capsid-walkthrough.png</span><span class="cap-media-meta">Uploading</span></button>
  <span class="cap-media-flags" id="library-capsid-walkthrough-flags"></span>
  <div class="cap-media-state"><div class="cap-meter" data-cap="meter"><span class="cap-meter-label" id="library-capsid-walkthrough-p">Uploading</span><span class="cap-meter-value">62%</span><progress class="cap-meter-bar" max="100" value="62" aria-labelledby="library-capsid-walkthrough-p" aria-valuetext="62 percent of capsid-walkthrough.png uploaded"></progress></div></div>
</li>
<li class="cap-media-tile" id="library-scan-0042" data-key="media/scan-0042.png" data-label="scan-0042.png" data-state="failed" data-kind="image" data-type="image/png" data-bytes="6291456" data-uploaded="2026-10-01" data-url="https://example.com/media/scan-0042.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='[]' data-error="The file is 6 MB and the limit is 5 MB.">
  <button type="button" class="cap-media-open" aria-describedby="library-scan-0042-flags" aria-disabled="true" aria-description="PNG, upload failed: The file is 6 MB and the limit is 5 MB."><span class="cap-media-thumb"><span class="cap-media-doc" aria-hidden="true">PNG</span></span><span class="cap-media-name" title="media/scan-0042.png">scan-0042.png</span><span class="cap-media-meta">Not uploaded</span></button>
  <span class="cap-media-flags" id="library-scan-0042-flags"></span>
  <div class="cap-media-state" data-tone="crit"><p class="cap-media-state-lead"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Upload failed</p><p class="cap-media-reason">The file is 6 MB and the limit is 5 MB.</p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry">Retry<span class="cap-sr-only"> uploading scan-0042.png</span></button></div>
</li>
<li class="cap-media-tile" id="library-launch-hero" data-key="media/launch-hero.jpg" data-label="launch-hero.jpg" data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="421888" data-width="1600" data-height="900" data-uploaded="2026-09-30" data-url="https://example.com/media/launch-hero.jpg" data-alt="set" data-alt-text="The status dashboard with three sites reporting healthy" data-title="Status dashboard" data-caption="Three sites, all green." data-tags="release, dashboard" data-used="2" data-used-in='[{&quot;title&quot;: &quot;Notes on the spring release&quot;, &quot;href&quot;: &quot;/admin/posts/spring-release/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;A quieter status page&quot;, &quot;href&quot;: &quot;/admin/posts/quieter-status-page/edit&quot;, &quot;how&quot;: &quot;cover&quot;}]' data-suggested-tags='["2026"]' data-active>
  <a class="cap-media-open" aria-describedby="library-launch-hero-flags" href="?key=media%2Flaunch-hero.jpg" aria-current="true"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%238c5fd2'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23e9defa'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/launch-hero.jpg">launch-hero.jpg</span><span class="cap-media-meta">JPEG · 412 kB</span></a>
  <span class="cap-media-flags" id="library-launch-hero-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/launch-hero.jpg" aria-label="Select launch-hero.jpg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="library-uptime-strip" data-key="media/uptime-strip.png" data-label="uptime-strip.png" data-state="ready" data-kind="image" data-type="image/png" data-bytes="98304" data-width="1200" data-height="300" data-uploaded="2026-09-28" data-url="https://example.com/media/uptime-strip.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="1" data-used-in='[{&quot;title&quot;: &quot;Why the uptime strip counts gaps&quot;, &quot;href&quot;: &quot;/admin/posts/uptime-gaps/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}]' data-suggested-tags='["uptime"]'>
  <a class="cap-media-open" aria-describedby="library-uptime-strip-flags" href="?key=media%2Fuptime-strip.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23d8ecea'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%23008489'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/uptime-strip.png">uptime-strip.png</span><span class="cap-media-meta">PNG · 96 kB</span></a>
  <span class="cap-media-flags" id="library-uptime-strip-flags"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>No alt text</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/uptime-strip.png" aria-label="Select uptime-strip.png" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="library-project-tree" data-key="media/project-tree.svg" data-label="project-tree.svg" data-state="ready" data-kind="image" data-type="image/svg+xml" data-bytes="18432" data-width="800" data-height="800" data-uploaded="2026-09-25" data-url="https://example.com/media/project-tree.svg" data-alt="decorative" data-alt-text="" data-title="" data-caption="" data-tags="diagrams" data-used="1" data-used-in='[{&quot;title&quot;: &quot;Field notes: reading a project tree&quot;, &quot;href&quot;: &quot;/admin/posts/project-tree/edit&quot;, &quot;how&quot;: &quot;figure&quot;}]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="library-project-tree-flags" href="?key=media%2Fproject-tree.svg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23f7dccb'/%3E%3Cg fill='%23cc4f0c'%3E%3Ccircle cx='160' cy='70' r='28'/%3E%3Ccircle cx='90' cy='170' r='28'/%3E%3Ccircle cx='230' cy='170' r='28'/%3E%3Ccircle cx='55' cy='260' r='22'/%3E%3Ccircle cx='125' cy='260' r='22'/%3E%3C/g%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/project-tree.svg">project-tree.svg</span><span class="cap-media-meta">SVG+XML · 18 kB</span></a>
  <span class="cap-media-flags" id="library-project-tree-flags"><span class="cap-status" data-tone="info"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><rect x="1.5" y="1.5" width="13" height="13" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path fill="currentColor" d="M7.2 7h1.6v5H7.2zM7.2 4h1.6v1.7H7.2z"/></svg>Decorative</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/project-tree.svg" aria-label="Select project-tree.svg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="library-fieldnotes-migration" data-key="media/fieldnotes-migration.jpg" data-label="fieldnotes-migration.jpg" data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="2516582" data-width="3000" data-height="2000" data-uploaded="2026-09-22" data-url="https://example.com/media/fieldnotes-migration.jpg" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='["2026", "field notes"]'>
  <a class="cap-media-open" aria-describedby="library-fieldnotes-migration-flags" href="?key=media%2Ffieldnotes-migration.jpg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23dfe3f1'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%235b6b9a'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23dfe3f1'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/fieldnotes-migration.jpg">fieldnotes-migration.jpg</span><span class="cap-media-meta">JPEG · 2.4 MB</span></a>
  <span class="cap-media-flags" id="library-fieldnotes-migration-flags"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>No alt text</span><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>Unattached</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/fieldnotes-migration.jpg" aria-label="Select fieldnotes-migration.jpg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="library-uptime-report-september" data-key="media/uptime-report-september.pdf" data-label="uptime-report-september.pdf" data-state="ready" data-kind="document" data-type="application/pdf" data-bytes="1887436" data-uploaded="2026-09-20" data-url="https://example.com/media/uptime-report-september.pdf" data-alt="set" data-alt-text="" data-title="" data-caption="" data-tags="reports" data-used="1" data-used-in='[{&quot;title&quot;: &quot;What a mention queue is for&quot;, &quot;href&quot;: &quot;/admin/posts/mention-queue/edit&quot;, &quot;how&quot;: &quot;linked&quot;}]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="library-uptime-report-september-flags" href="?key=media%2Fuptime-report-september.pdf"><span class="cap-media-thumb"><span class="cap-media-doc" aria-hidden="true">PDF</span></span><span class="cap-media-name" title="media/uptime-report-september.pdf">uptime-report-september.pdf</span><span class="cap-media-meta">PDF · 1.8 MB</span></a>
  <span class="cap-media-flags" id="library-uptime-report-september-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/uptime-report-september.pdf" aria-label="Select uptime-report-september.pdf" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
</ul></section>
<section class="cap-media-group" aria-labelledby="library-g-august"><h2 class="cap-media-group-title" id="library-g-august">August 2026 <span class="cap-media-group-count">2 on this page</span></h2>
<ul class="cap-media-grid" role="list" aria-label="Files, August 2026">
<li class="cap-media-tile" id="library-mention-queue" data-key="media/mention-queue.png" data-label="mention-queue.png" data-state="ready" data-kind="image" data-type="image/png" data-bytes="207872" data-width="1400" data-height="900" data-uploaded="2026-08-27" data-url="https://example.com/media/mention-queue.png" data-alt="set" data-alt-text="The mention queue with four mentions waiting" data-title="" data-caption="" data-tags="mentions" data-used="3" data-used-in='[{&quot;title&quot;: &quot;What a mention queue is for&quot;, &quot;href&quot;: &quot;/admin/posts/mention-queue/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;Undo is cheaper than are-you-sure&quot;, &quot;href&quot;: &quot;/admin/posts/undo/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;Search without a server&quot;, &quot;href&quot;: &quot;/admin/posts/search/edit&quot;, &quot;how&quot;: &quot;cover&quot;}]' data-suggested-tags='[]' data-selected>
  <a class="cap-media-open" aria-describedby="library-mention-queue-flags" href="?key=media%2Fmention-queue.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23ece5ff'/%3E%3Crect x='60' y='60' width='200' height='30' fill='%234f2d7f'/%3E%3Crect x='60' y='120' width='140' height='30' fill='%234f2d7f'/%3E%3Crect x='60' y='180' width='200' height='80' fill='%234f2d7f'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/mention-queue.png">mention-queue.png</span><span class="cap-media-meta">PNG · 203 kB</span></a>
  <span class="cap-media-flags" id="library-mention-queue-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/mention-queue.png" aria-label="Select mention-queue.png" checked /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="library-old-logo" data-key="media/old-logo.png" data-label="old-logo.png" data-state="binned" data-kind="image" data-type="image/png" data-bytes="40960" data-width="512" data-height="512" data-uploaded="2026-08-02" data-url="https://example.com/media/old-logo.png" data-alt="set" data-alt-text="The previous site logo" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="library-old-logo-flags" href="?key=media%2Fold-logo.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e8e6ee'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%236b6677'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/old-logo.png">old-logo.png</span><span class="cap-media-meta">PNG · 40 kB</span></a>
  <span class="cap-media-flags" id="library-old-logo-flags"><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>In Trash</span><button type="button" class="cap-btn" data-size="xs" data-cap-part="restore" tabindex="-1">Restore<span class="cap-sr-only"> old-logo.png</span></button></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/old-logo.png" aria-label="Select old-logo.png" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
</ul></section>
      </div>
      <div class="cap-media-empty" hidden>
  <div class="cap-empty" data-kind="no-match" data-flush data-cap-empty="search" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">No files match your search</p><p class="cap-empty-text">Searched names, alt text, captions and tags.</p></div>
    <div class="cap-empty-content"><button type="button" class="cap-btn" data-cap-part="clear-search">Clear the search</button></div>
  </div>
  <div class="cap-empty" data-kind="no-match" data-flush data-cap-empty="filter" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Nothing in this view</p><p class="cap-empty-text">Every file passes these checks.</p></div>
    <div class="cap-empty-content"><button type="button" class="cap-btn" data-cap-part="clear-filters">Show everything</button></div>
  </div>
  <div class="cap-empty" data-kind="nothing-yet" data-cap-empty="library" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Nothing here yet</p><p class="cap-empty-text">Files you upload get an address you can paste into any post.</p></div>
    <div class="cap-empty-content"><div class="cap-drop" data-cap="drop-zone" data-max-bytes="5242880" data-max-files="10" id="library-empty-drop">
  <label class="cap-drop-label">
    <input class="cap-drop-input" type="file" multiple accept="image/*,.pdf" data-cap-part="input" aria-labelledby="library-empty-drop-title" aria-describedby="library-empty-drop-hint" />
    <span class="cap-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4m0 0L7 9m5-5 5 5M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" /></svg></span>
    <span class="cap-drop-title" id="library-empty-drop-title"><span class="cap-drop-idle">Drop files here, or <span class="cap-drop-browse">browse</span></span><span class="cap-drop-over">Drop to upload</span></span>
    <span class="cap-drop-hint" id="library-empty-drop-hint">Images and PDF, up to 5 MB each, up to 10 at a time.</span>
  </label>
  <div class="cap-drop-status" role="status" data-cap-part="status"></div>
  <div class="cap-drop-rejections" role="alert" data-cap-part="rejections"></div>
</div></div>
  </div>
  <div class="cap-empty" data-kind="all-clear" data-cap-empty="bin" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Trash is empty</p><p class="cap-empty-text">A file you move to Trash keeps its address, and waits here until you restore it.</p></div>
  </div>
</div>
      <div class="cap-message" data-cap="message" role="status" aria-label="Results and failures" aria-atomic="false"></div>
    </div>
    <dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="library-ins" aria-labelledby="library-ins-title" open>
  <div class="cap-dialog-header" data-divider>
    <h2 class="cap-dialog-title cap-media-title" id="library-ins-title" data-cap-part="title">launch-hero.jpg</h2>
    <p class="cap-dialog-description" data-cap-part="subtitle">JPEG · 412 kB · 1600 by 900</p>
  </div>
  <form class="cap-dialog-body cap-media-form" id="library-ins-form" method="post" action="/admin/media/save" data-cap-part="form">
    <input type="hidden" name="key" value="media/launch-hero.jpg" data-cap-part="key" />
    <div class="cap-media-preview"><img data-cap-part="preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%238c5fd2'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23e9defa'/%3E%3C/svg%3E" alt="" width="640" height="427" /></div>
    <div class="cap-field" data-cap-part="alt-field">
      <label class="cap-field-label" for="library-ins-alt">Alt text</label>
      <textarea class="cap-input" id="library-ins-alt" name="alt" rows="2" data-cap-part="alt" aria-describedby="library-ins-alt-help" placeholder="Describe what the picture shows">The status dashboard with three sites reporting healthy</textarea>
      <p class="cap-field-help" id="library-ins-alt-help">What a person who cannot see the picture needs to know. Leave out “image of”.</p>
    </div>
    <div class="cap-field" data-cap-part="decorative-field">
      <label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" aria-describedby="library-ins-deco-help" /> Decorative image</label>
      <p class="cap-field-help" id="library-ins-deco-help">It adds nothing a reader needs, so a screen reader skips it. This is a choice, not a missing description.</p>
    </div>
    <p class="cap-field-help" data-cap-part="alt-document" hidden>A document takes no alt text. What a reader hears is the link text, and that lives in the post.</p>
    <div class="cap-field">
      <label class="cap-field-label" for="library-ins-title-field">Title</label>
      <input class="cap-input" id="library-ins-title-field" name="title" type="text" autocomplete="off" data-cap-part="title-field" value="Status dashboard" />
    </div>
    <div class="cap-field">
      <label class="cap-field-label" for="library-ins-caption">Caption</label>
      <textarea class="cap-input" id="library-ins-caption" name="caption" rows="2" data-cap-part="caption">Three sites, all green.</textarea>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="library-ins-tags-l">
      <span class="cap-field-label" id="library-ins-tags-l">Tags</span>
      <ul class="cap-media-tags" data-cap-part="tags"><li><button type="button" class="cap-chip" data-cap-tag="release" aria-label="Remove tag release">release <span aria-hidden="true">×</span></button></li><li><button type="button" class="cap-chip" data-cap-tag="dashboard" aria-label="Remove tag dashboard">dashboard <span aria-hidden="true">×</span></button></li></ul>
      <input type="hidden" name="tags" value="release, dashboard" data-cap-part="tags-value" />
      <label class="cap-sr-only" for="library-ins-tag-input">Add a tag</label>
      <input class="cap-input" id="library-ins-tag-input" type="text" autocomplete="off" placeholder="Add a tag, then press Enter" data-cap-part="tag-input" />
      <ul class="cap-media-tags" data-cap-part="suggestions"><li><button type="button" class="cap-chip" data-cap-suggest="2026" aria-label="Add suggested tag 2026">+ 2026</button></li></ul>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="library-ins-addr-l">
      <label class="cap-field-label" id="library-ins-addr-l" for="library-ins-addr">Address</label>
      <input class="cap-input" id="library-ins-addr" readonly value="https://example.com/media/launch-hero.jpg" data-cap-part="address" />
      <div class="cap-media-copy"><button type="button" class="cap-btn" data-size="sm" data-cap-copy="https://example.com/media/launch-hero.jpg" data-cap-copy-kind="address" aria-label="Copy address"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><span data-cap-part="copy-label">Copy address</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="![The status dashboard with three sites reporting healthy](https://example.com/media/launch-hero.jpg)" data-cap-copy-kind="markdown" aria-label="Copy the Markdown image"><span data-cap-part="copy-label">Markdown</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="&lt;img src=&quot;https://example.com/media/launch-hero.jpg&quot; alt=&quot;The status dashboard with three sites reporting healthy&quot;&gt;" data-cap-copy-kind="html" aria-label="Copy the HTML tag"><span data-cap-part="copy-label">HTML tag</span></button></div>
      <p class="cap-media-copied" role="status" data-cap-part="copied"></p>
    </div>
    <dl class="cap-media-facts" data-cap-part="facts"><dt>Key</dt><dd>media/launch-hero.jpg</dd><dt>Type</dt><dd>image/jpeg</dd><dt>Size</dt><dd>412 kB</dd><dt>Dimensions</dt><dd>1600 by 900</dd><dt>Uploaded</dt><dd>2026-09-30</dd></dl>
    <section class="cap-media-section" aria-labelledby="library-ins-used-l">
      <h3 id="library-ins-used-l">Used in</h3>
      <div data-cap-part="used"><ul class="cap-media-used"><li><a href="/admin/posts/spring-release/edit">Notes on the spring release</a><span class="cap-media-used-how">image in the body</span></li><li><a href="/admin/posts/quieter-status-page/edit">A quieter status page</a><span class="cap-media-used-how">cover</span></li></ul></div>
    </section>
    <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>
  </form>
  <div class="cap-dialog-footer">
    <div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div>
    <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button>
    <button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
  </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>
  </div>
</div>

  </main>

Narrow: the inspector is a side sheet

  <main>

<div class="cap-media" data-cap="media" id="narrow">
  <div class="cap-media-layout">
    <div class="cap-media-main">
      <div class="cap-drop" data-cap="drop-zone" data-scope="page" data-paste data-max-bytes="5242880" data-max-files="10" id="narrow-drop">
  <label class="cap-drop-label">
    <input class="cap-drop-input" type="file" multiple accept="image/*,.pdf" data-cap-part="input" aria-labelledby="narrow-drop-title" aria-describedby="narrow-drop-hint" />
    <span class="cap-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4m0 0L7 9m5-5 5 5M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" /></svg></span>
    <span class="cap-drop-title" id="narrow-drop-title"><span class="cap-drop-idle">Drop files anywhere on this page, or <span class="cap-drop-browse">browse</span></span><span class="cap-drop-over">Drop to upload</span></span>
    <span class="cap-drop-hint" id="narrow-drop-hint">Images and PDF, up to 5 MB each, up to 10 at a time.</span>
  </label>
  <div class="cap-drop-status" role="status" data-cap-part="status"></div>
  <div class="cap-drop-rejections" role="alert" data-cap-part="rejections"></div>
  <div class="cap-drop-overlay" aria-hidden="true"><div><p class="cap-drop-overlay-title">Drop to upload</p><p class="cap-drop-overlay-text">Release anywhere on this page to add the files.</p></div></div>
</div>
      <div class="cap-media-toolbar">
  <div class="cap-field cap-media-search">
    <label class="cap-sr-only" for="narrow-q">Search files</label>
    <input class="cap-input" type="search" id="narrow-q" data-cap-part="search" placeholder="Search 4 files" autocomplete="off" />
  </div>
  <div class="cap-chips" data-cap="chips" data-cap-part="filters" role="group" aria-labelledby="narrow-f-l">
    <span class="cap-chips-label" id="narrow-f-l">Show</span>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="unattached">Unattached <span class="cap-chip-count">1</span></button>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="no-alt">No alt text <span class="cap-chip-count">2</span></button>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="large">Over 1 MB <span class="cap-chip-count">1</span></button>
    <button type="button" class="cap-link-btn" data-cap-part="clear" hidden>Clear</button>
  </div>
  <fieldset class="cap-seg" data-cap-part="view">
    <legend class="cap-sr-only">Show files from</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="narrow-view" value="library" checked /> Library <span data-cap-count="library">4</span></label>
      <label><input type="radio" name="narrow-view" value="bin" /> Trash <span data-cap-count="bin">0</span></label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="sort">
    <legend class="cap-sr-only">Sort by</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="narrow-sort" value="added" checked /> Newest</label>
      <label><input type="radio" name="narrow-sort" value="name" /> A to Z</label>
      <label><input type="radio" name="narrow-sort" value="size" /> Largest</label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="layout">
    <legend class="cap-sr-only">Layout</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="narrow-layout" value="grid" checked /> Grid</label>
      <label><input type="radio" name="narrow-layout" value="list" /> List</label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="size">
    <legend class="cap-sr-only">Tile size</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="narrow-size" value="s" /> S</label>
      <label><input type="radio" name="narrow-size" value="m" checked /> M</label>
      <label><input type="radio" name="narrow-size" value="l" /> L</label>
    </div>
  </fieldset>
</div>
      <div class="cap-bulk" data-cap="bulk-bar" data-cap-list="narrow-tiles" role="region" aria-label="Bulk actions" id="narrow-bulk" hidden>
  <p class="cap-bulk-count" role="status"></p>
  <button type="button" class="cap-btn" data-variant="quiet" data-cap-part="select-all" data-cap-label="Select all {n} in view">Select all in view</button>
  <div class="cap-bulk-actions">
    <button type="button" class="cap-btn" data-cap-bulk-action="copy" data-cap-label="Copy">Copy addresses</button>
    <span class="cap-bulk-field"><label for="narrow-bulk-tag">Tag</label><input class="cap-input" id="narrow-bulk-tag" autocomplete="off" placeholder="tag name" /></span>
    <button type="button" class="cap-btn" data-cap-bulk-action="add-tag" data-cap-value="#narrow-bulk-tag" data-cap-label="Add tag">Add tag</button>
    <button type="button" class="cap-btn" data-cap-bulk-action="remove-tag" data-cap-value="#narrow-bulk-tag" data-cap-label="Remove tag">Remove tag</button>
    <button type="button" class="cap-btn" data-cap-bulk-action="bin" data-cap-label="Trash">Move to Trash</button>
    <button type="button" class="cap-btn" data-variant="danger" data-cap-bulk-action="delete" data-destructive data-cap-label="Delete" data-cap-confirm-title="Delete {n} file{s} for good?" data-cap-confirm-lead="A deleted file cannot be brought back by uploading it again: its address is a hash of its content." data-cap-confirm-action="Delete {n} file{s}">Delete for good</button>
  </div>
  <button type="button" class="cap-btn cap-bulk-clear" data-variant="quiet" data-cap-part="clear-bar">Clear selection</button>
</div>
      <p class="cap-media-count" role="status">4 files</p>
      <div id="narrow-tiles">
<section class="cap-media-group" aria-labelledby="narrow-g-september"><h2 class="cap-media-group-title" id="narrow-g-september">September 2026 <span class="cap-media-group-count">4 on this page</span></h2>
<ul class="cap-media-grid" role="list" aria-label="Files, September 2026">
<li class="cap-media-tile" id="narrow-launch-hero" data-key="media/launch-hero.jpg" data-label="launch-hero.jpg" data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="421888" data-width="1600" data-height="900" data-uploaded="2026-09-30" data-url="https://example.com/media/launch-hero.jpg" data-alt="set" data-alt-text="The status dashboard with three sites reporting healthy" data-title="Status dashboard" data-caption="Three sites, all green." data-tags="release, dashboard" data-used="2" data-used-in='[{&quot;title&quot;: &quot;Notes on the spring release&quot;, &quot;href&quot;: &quot;/admin/posts/spring-release/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}, {&quot;title&quot;: &quot;A quieter status page&quot;, &quot;href&quot;: &quot;/admin/posts/quieter-status-page/edit&quot;, &quot;how&quot;: &quot;cover&quot;}]' data-suggested-tags='["2026"]' data-active>
  <a class="cap-media-open" aria-describedby="narrow-launch-hero-flags" href="?key=media%2Flaunch-hero.jpg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%238c5fd2'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23e9defa'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/launch-hero.jpg">launch-hero.jpg</span><span class="cap-media-meta">JPEG · 412 kB</span></a>
  <span class="cap-media-flags" id="narrow-launch-hero-flags"></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/launch-hero.jpg" aria-label="Select launch-hero.jpg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="narrow-uptime-strip" data-key="media/uptime-strip.png" data-label="uptime-strip.png" data-state="ready" data-kind="image" data-type="image/png" data-bytes="98304" data-width="1200" data-height="300" data-uploaded="2026-09-28" data-url="https://example.com/media/uptime-strip.png" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="1" data-used-in='[{&quot;title&quot;: &quot;Why the uptime strip counts gaps&quot;, &quot;href&quot;: &quot;/admin/posts/uptime-gaps/edit&quot;, &quot;how&quot;: &quot;image in the body&quot;}]' data-suggested-tags='["uptime"]'>
  <a class="cap-media-open" aria-describedby="narrow-uptime-strip-flags" href="?key=media%2Fuptime-strip.png"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23d8ecea'/%3E%3Cpath d='M0 250 80 130 150 200 220 90 320 230V320H0z' fill='%23008489'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/uptime-strip.png">uptime-strip.png</span><span class="cap-media-meta">PNG · 96 kB</span></a>
  <span class="cap-media-flags" id="narrow-uptime-strip-flags"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>No alt text</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/uptime-strip.png" aria-label="Select uptime-strip.png" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="narrow-project-tree" data-key="media/project-tree.svg" data-label="project-tree.svg" data-state="ready" data-kind="image" data-type="image/svg+xml" data-bytes="18432" data-width="800" data-height="800" data-uploaded="2026-09-25" data-url="https://example.com/media/project-tree.svg" data-alt="decorative" data-alt-text="" data-title="" data-caption="" data-tags="diagrams" data-used="1" data-used-in='[{&quot;title&quot;: &quot;Field notes: reading a project tree&quot;, &quot;href&quot;: &quot;/admin/posts/project-tree/edit&quot;, &quot;how&quot;: &quot;figure&quot;}]' data-suggested-tags='[]'>
  <a class="cap-media-open" aria-describedby="narrow-project-tree-flags" href="?key=media%2Fproject-tree.svg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23f7dccb'/%3E%3Cg fill='%23cc4f0c'%3E%3Ccircle cx='160' cy='70' r='28'/%3E%3Ccircle cx='90' cy='170' r='28'/%3E%3Ccircle cx='230' cy='170' r='28'/%3E%3Ccircle cx='55' cy='260' r='22'/%3E%3Ccircle cx='125' cy='260' r='22'/%3E%3C/g%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/project-tree.svg">project-tree.svg</span><span class="cap-media-meta">SVG+XML · 18 kB</span></a>
  <span class="cap-media-flags" id="narrow-project-tree-flags"><span class="cap-status" data-tone="info"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><rect x="1.5" y="1.5" width="13" height="13" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path fill="currentColor" d="M7.2 7h1.6v5H7.2zM7.2 4h1.6v1.7H7.2z"/></svg>Decorative</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/project-tree.svg" aria-label="Select project-tree.svg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
<li class="cap-media-tile" id="narrow-fieldnotes-migration" data-key="media/fieldnotes-migration.jpg" data-label="fieldnotes-migration.jpg" data-state="ready" data-kind="image" data-type="image/jpeg" data-bytes="2516582" data-width="3000" data-height="2000" data-uploaded="2026-09-22" data-url="https://example.com/media/fieldnotes-migration.jpg" data-alt="missing" data-alt-text="" data-title="" data-caption="" data-tags="" data-used="0" data-used-in='[]' data-suggested-tags='["2026", "field notes"]'>
  <a class="cap-media-open" aria-describedby="narrow-fieldnotes-migration-flags" href="?key=media%2Ffieldnotes-migration.jpg"><span class="cap-media-thumb"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23dfe3f1'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%235b6b9a'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23dfe3f1'/%3E%3C/svg%3E" alt="" loading="lazy" decoding="async" width="320" height="320" /></span><span class="cap-media-name" title="media/fieldnotes-migration.jpg">fieldnotes-migration.jpg</span><span class="cap-media-meta">JPEG · 2.4 MB</span></a>
  <span class="cap-media-flags" id="narrow-fieldnotes-migration-flags"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>No alt text</span><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>Unattached</span></span>
  <label class="cap-media-check"><input type="checkbox" data-cap-select value="media/fieldnotes-migration.jpg" aria-label="Select fieldnotes-migration.jpg" /><span class="cap-media-check-box" aria-hidden="true"><svg viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M3.5 8.5l3 3 6-7" /></svg></span><span class="cap-media-check-word" aria-hidden="true">Selected</span></label>
</li>
</ul></section>
      </div>
      <div class="cap-media-empty" hidden>
  <div class="cap-empty" data-kind="no-match" data-flush data-cap-empty="search" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">No files match your search</p><p class="cap-empty-text">Searched names, alt text, captions and tags.</p></div>
    <div class="cap-empty-content"><button type="button" class="cap-btn" data-cap-part="clear-search">Clear the search</button></div>
  </div>
  <div class="cap-empty" data-kind="no-match" data-flush data-cap-empty="filter" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Nothing in this view</p><p class="cap-empty-text">Every file passes these checks.</p></div>
    <div class="cap-empty-content"><button type="button" class="cap-btn" data-cap-part="clear-filters">Show everything</button></div>
  </div>
  <div class="cap-empty" data-kind="nothing-yet" data-cap-empty="library" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Nothing here yet</p><p class="cap-empty-text">Files you upload get an address you can paste into any post.</p></div>
    <div class="cap-empty-content"><div class="cap-drop" data-cap="drop-zone" data-max-bytes="5242880" data-max-files="10" id="narrow-empty-drop">
  <label class="cap-drop-label">
    <input class="cap-drop-input" type="file" multiple accept="image/*,.pdf" data-cap-part="input" aria-labelledby="narrow-empty-drop-title" aria-describedby="narrow-empty-drop-hint" />
    <span class="cap-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4m0 0L7 9m5-5 5 5M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" /></svg></span>
    <span class="cap-drop-title" id="narrow-empty-drop-title"><span class="cap-drop-idle">Drop files here, or <span class="cap-drop-browse">browse</span></span><span class="cap-drop-over">Drop to upload</span></span>
    <span class="cap-drop-hint" id="narrow-empty-drop-hint">Images and PDF, up to 5 MB each, up to 10 at a time.</span>
  </label>
  <div class="cap-drop-status" role="status" data-cap-part="status"></div>
  <div class="cap-drop-rejections" role="alert" data-cap-part="rejections"></div>
</div></div>
  </div>
  <div class="cap-empty" data-kind="all-clear" data-cap-empty="bin" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Trash is empty</p><p class="cap-empty-text">A file you move to Trash keeps its address, and waits here until you restore it.</p></div>
  </div>
</div>
      <div class="cap-message" data-cap="message" role="status" aria-label="Results and failures" aria-atomic="false"></div>
    </div>
    <dialog class="cap-dialog cap-media-inspector" data-cap="media-inspector" data-placement="right" data-size="md" id="narrow-ins" aria-labelledby="narrow-ins-title" open>
  <div class="cap-dialog-header" data-divider>
    <h2 class="cap-dialog-title cap-media-title" id="narrow-ins-title" data-cap-part="title">launch-hero.jpg</h2>
    <p class="cap-dialog-description" data-cap-part="subtitle">JPEG · 412 kB · 1600 by 900</p>
  </div>
  <form class="cap-dialog-body cap-media-form" id="narrow-ins-form" method="post" action="/admin/media/save" data-cap-part="form">
    <input type="hidden" name="key" value="media/launch-hero.jpg" data-cap-part="key" />
    <div class="cap-media-preview"><img data-cap-part="preview" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Crect width='320' height='320' fill='%23e9defa'/%3E%3Crect x='40' y='70' width='240' height='150' rx='12' fill='%238c5fd2'/%3E%3Ccircle cx='96' cy='118' r='20' fill='%23e9defa'/%3E%3C/svg%3E" alt="" width="640" height="427" /></div>
    <div class="cap-field" data-cap-part="alt-field">
      <label class="cap-field-label" for="narrow-ins-alt">Alt text</label>
      <textarea class="cap-input" id="narrow-ins-alt" name="alt" rows="2" data-cap-part="alt" aria-describedby="narrow-ins-alt-help" placeholder="Describe what the picture shows">The status dashboard with three sites reporting healthy</textarea>
      <p class="cap-field-help" id="narrow-ins-alt-help">What a person who cannot see the picture needs to know. Leave out “image of”.</p>
    </div>
    <div class="cap-field" data-cap-part="decorative-field">
      <label class="cap-check"><input type="checkbox" name="decorative" data-cap-part="decorative" aria-describedby="narrow-ins-deco-help" /> Decorative image</label>
      <p class="cap-field-help" id="narrow-ins-deco-help">It adds nothing a reader needs, so a screen reader skips it. This is a choice, not a missing description.</p>
    </div>
    <p class="cap-field-help" data-cap-part="alt-document" hidden>A document takes no alt text. What a reader hears is the link text, and that lives in the post.</p>
    <div class="cap-field">
      <label class="cap-field-label" for="narrow-ins-title-field">Title</label>
      <input class="cap-input" id="narrow-ins-title-field" name="title" type="text" autocomplete="off" data-cap-part="title-field" value="Status dashboard" />
    </div>
    <div class="cap-field">
      <label class="cap-field-label" for="narrow-ins-caption">Caption</label>
      <textarea class="cap-input" id="narrow-ins-caption" name="caption" rows="2" data-cap-part="caption">Three sites, all green.</textarea>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="narrow-ins-tags-l">
      <span class="cap-field-label" id="narrow-ins-tags-l">Tags</span>
      <ul class="cap-media-tags" data-cap-part="tags"><li><button type="button" class="cap-chip" data-cap-tag="release" aria-label="Remove tag release">release <span aria-hidden="true">×</span></button></li><li><button type="button" class="cap-chip" data-cap-tag="dashboard" aria-label="Remove tag dashboard">dashboard <span aria-hidden="true">×</span></button></li></ul>
      <input type="hidden" name="tags" value="release, dashboard" data-cap-part="tags-value" />
      <label class="cap-sr-only" for="narrow-ins-tag-input">Add a tag</label>
      <input class="cap-input" id="narrow-ins-tag-input" type="text" autocomplete="off" placeholder="Add a tag, then press Enter" data-cap-part="tag-input" />
      <ul class="cap-media-tags" data-cap-part="suggestions"><li><button type="button" class="cap-chip" data-cap-suggest="2026" aria-label="Add suggested tag 2026">+ 2026</button></li></ul>
    </div>
    <div class="cap-media-section" role="group" aria-labelledby="narrow-ins-addr-l">
      <label class="cap-field-label" id="narrow-ins-addr-l" for="narrow-ins-addr">Address</label>
      <input class="cap-input" id="narrow-ins-addr" readonly value="https://example.com/media/launch-hero.jpg" data-cap-part="address" />
      <div class="cap-media-copy"><button type="button" class="cap-btn" data-size="sm" data-cap-copy="https://example.com/media/launch-hero.jpg" data-cap-copy-kind="address" aria-label="Copy address"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><span data-cap-part="copy-label">Copy address</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="![The status dashboard with three sites reporting healthy](https://example.com/media/launch-hero.jpg)" data-cap-copy-kind="markdown" aria-label="Copy the Markdown image"><span data-cap-part="copy-label">Markdown</span></button><button type="button" class="cap-btn" data-size="sm" data-cap-copy="&lt;img src=&quot;https://example.com/media/launch-hero.jpg&quot; alt=&quot;The status dashboard with three sites reporting healthy&quot;&gt;" data-cap-copy-kind="html" aria-label="Copy the HTML tag"><span data-cap-part="copy-label">HTML tag</span></button></div>
      <p class="cap-media-copied" role="status" data-cap-part="copied"></p>
    </div>
    <dl class="cap-media-facts" data-cap-part="facts"><dt>Key</dt><dd>media/launch-hero.jpg</dd><dt>Type</dt><dd>image/jpeg</dd><dt>Size</dt><dd>412 kB</dd><dt>Dimensions</dt><dd>1600 by 900</dd><dt>Uploaded</dt><dd>2026-09-30</dd></dl>
    <section class="cap-media-section" aria-labelledby="narrow-ins-used-l">
      <h3 id="narrow-ins-used-l">Used in</h3>
      <div data-cap-part="used"><ul class="cap-media-used"><li><a href="/admin/posts/spring-release/edit">Notes on the spring release</a><span class="cap-media-used-how">image in the body</span></li><li><a href="/admin/posts/quieter-status-page/edit">A quieter status page</a><span class="cap-media-used-how">cover</span></li></ul></div>
    </section>
    <button type="submit" class="cap-btn" data-variant="primary" data-cap-part="save-fallback">Save</button>
  </form>
  <div class="cap-dialog-footer">
    <div class="cap-media-save" data-cap-part="save" data-state="idle"><p role="status" data-cap-part="save-status">Changes save by themselves.</p><p role="alert" data-cap-part="save-error"></p><button type="button" class="cap-btn" data-size="sm" data-cap-part="retry-save" hidden>Retry</button></div>
    <button type="button" class="cap-btn" data-cap-part="bin">Move to Trash</button>
    <button type="button" class="cap-btn" data-cap-part="restore" hidden>Restore</button>
  </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>
  </div>
</div>

  </main>

An empty library with the drop zone

  <main>

<div class="cap-media" data-cap="media" id="blank">
  <div class="cap-media-layout">
    <div class="cap-media-main">
      <div class="cap-media-toolbar">
  <div class="cap-field cap-media-search">
    <label class="cap-sr-only" for="blank-q">Search files</label>
    <input class="cap-input" type="search" id="blank-q" data-cap-part="search" placeholder="Search 0 files" autocomplete="off" />
  </div>
  <div class="cap-chips" data-cap="chips" data-cap-part="filters" role="group" aria-labelledby="blank-f-l">
    <span class="cap-chips-label" id="blank-f-l">Show</span>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="unattached">Unattached <span class="cap-chip-count">0</span></button>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="no-alt">No alt text <span class="cap-chip-count">0</span></button>
    <button type="button" class="cap-chip" aria-pressed="false" data-value="large">Over 1 MB <span class="cap-chip-count">0</span></button>
    <button type="button" class="cap-link-btn" data-cap-part="clear" hidden>Clear</button>
  </div>
  <fieldset class="cap-seg" data-cap-part="view">
    <legend class="cap-sr-only">Show files from</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="blank-view" value="library" checked /> Library <span data-cap-count="library">0</span></label>
      <label><input type="radio" name="blank-view" value="bin" /> Trash <span data-cap-count="bin">0</span></label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="sort">
    <legend class="cap-sr-only">Sort by</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="blank-sort" value="added" checked /> Newest</label>
      <label><input type="radio" name="blank-sort" value="name" /> A to Z</label>
      <label><input type="radio" name="blank-sort" value="size" /> Largest</label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="layout">
    <legend class="cap-sr-only">Layout</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="blank-layout" value="grid" checked /> Grid</label>
      <label><input type="radio" name="blank-layout" value="list" /> List</label>
    </div>
  </fieldset>
  <fieldset class="cap-seg" data-cap-part="size">
    <legend class="cap-sr-only">Tile size</legend>
    <div class="cap-seg-options" data-size="sm">
      <label><input type="radio" name="blank-size" value="s" /> S</label>
      <label><input type="radio" name="blank-size" value="m" checked /> M</label>
      <label><input type="radio" name="blank-size" value="l" /> L</label>
    </div>
  </fieldset>
</div>
      <div class="cap-bulk" data-cap="bulk-bar" data-cap-list="blank-tiles" role="region" aria-label="Bulk actions" id="blank-bulk" hidden>
  <p class="cap-bulk-count" role="status"></p>
  <button type="button" class="cap-btn" data-variant="quiet" data-cap-part="select-all" data-cap-label="Select all {n} in view">Select all in view</button>
  <div class="cap-bulk-actions">
    <button type="button" class="cap-btn" data-cap-bulk-action="copy" data-cap-label="Copy">Copy addresses</button>
    <span class="cap-bulk-field"><label for="blank-bulk-tag">Tag</label><input class="cap-input" id="blank-bulk-tag" autocomplete="off" placeholder="tag name" /></span>
    <button type="button" class="cap-btn" data-cap-bulk-action="add-tag" data-cap-value="#blank-bulk-tag" data-cap-label="Add tag">Add tag</button>
    <button type="button" class="cap-btn" data-cap-bulk-action="remove-tag" data-cap-value="#blank-bulk-tag" data-cap-label="Remove tag">Remove tag</button>
    <button type="button" class="cap-btn" data-cap-bulk-action="bin" data-cap-label="Trash">Move to Trash</button>
    <button type="button" class="cap-btn" data-variant="danger" data-cap-bulk-action="delete" data-destructive data-cap-label="Delete" data-cap-confirm-title="Delete {n} file{s} for good?" data-cap-confirm-lead="A deleted file cannot be brought back by uploading it again: its address is a hash of its content." data-cap-confirm-action="Delete {n} file{s}">Delete for good</button>
  </div>
  <button type="button" class="cap-btn cap-bulk-clear" data-variant="quiet" data-cap-part="clear-bar">Clear selection</button>
</div>
      <p class="cap-media-count" role="status">0 files</p>
      <div id="blank-tiles"><ul class="cap-media-grid" role="list" aria-label="Files"></ul></div>
      <div class="cap-media-empty">
  <div class="cap-empty" data-kind="no-match" data-flush data-cap-empty="search" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">No files match your search</p><p class="cap-empty-text">Searched names, alt text, captions and tags.</p></div>
    <div class="cap-empty-content"><button type="button" class="cap-btn" data-cap-part="clear-search">Clear the search</button></div>
  </div>
  <div class="cap-empty" data-kind="no-match" data-flush data-cap-empty="filter" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Nothing in this view</p><p class="cap-empty-text">Every file passes these checks.</p></div>
    <div class="cap-empty-content"><button type="button" class="cap-btn" data-cap-part="clear-filters">Show everything</button></div>
  </div>
  <div class="cap-empty" data-kind="nothing-yet" data-cap-empty="library">
    <div class="cap-empty-header"><p class="cap-empty-title">Nothing here yet</p><p class="cap-empty-text">Files you upload get an address you can paste into any post.</p></div>
    <div class="cap-empty-content"><div class="cap-drop" data-cap="drop-zone" data-max-bytes="5242880" data-max-files="10" id="blank-empty-drop">
  <label class="cap-drop-label">
    <input class="cap-drop-input" type="file" multiple accept="image/*,.pdf" data-cap-part="input" aria-labelledby="blank-empty-drop-title" aria-describedby="blank-empty-drop-hint" />
    <span class="cap-drop-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4m0 0L7 9m5-5 5 5M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" /></svg></span>
    <span class="cap-drop-title" id="blank-empty-drop-title"><span class="cap-drop-idle">Drop files here, or <span class="cap-drop-browse">browse</span></span><span class="cap-drop-over">Drop to upload</span></span>
    <span class="cap-drop-hint" id="blank-empty-drop-hint">Images and PDF, up to 5 MB each, up to 10 at a time.</span>
  </label>
  <div class="cap-drop-status" role="status" data-cap-part="status"></div>
  <div class="cap-drop-rejections" role="alert" data-cap-part="rejections"></div>
</div></div>
  </div>
  <div class="cap-empty" data-kind="all-clear" data-cap-empty="bin" hidden>
    <div class="cap-empty-header"><p class="cap-empty-title">Trash is empty</p><p class="cap-empty-text">A file you move to Trash keeps its address, and waits here until you restore it.</p></div>
  </div>
</div>
      <div class="cap-message" data-cap="message" role="status" aria-label="Results and failures" aria-atomic="false"></div>
    </div>
  </div>
</div>

  </main>

React: MediaGrid and MediaInspector

<main>
  <div data-mount="react"></div>
</main>

API reference

MediaInspector

PropTypeRequiredDoes
itemMediaRecord | nullYesThe file, or null for none.
openbooleanYes
modeMediaModeYes
onSave(key: string, fields: MediaFields) => Promise<void>YesSends the fields. Reject with an Error that says why; the pane shows it and Retry.
onClose() => voidYes
onBin(key: string) => void
onRestore(key: string) => void
onShowUnattached() => voidThe grid's Unattached filter, from the "Show unattached files" button.
openerHTMLElement | nullThe tile that opened a sheet: focus returns here.
onStep(dir: "prev" | "next") => voidAlt and an arrow in a field: the previous or next file. The app moves its active key.
idstring
refRef<{ focus: () => void }>focus() puts focus in the first field: call it when the person asked to open the inspector (Enter on a tile).
show{ alt?: boolean; title?: boolean; caption?: boolean; tags?: boolean }Which fields it shows. All by default; a site that keeps no title or caption leaves them out.
saving"auto" | "form""auto" (the default) saves by itself through onSave. "form" is one form per field with its own Save button, posting to action, so it works with no script.
actionstringWhere its forms post: the fields in form mode, and Move to Trash, Restore and Delete in either mode (each a form with intent, ids and version). Without it those are buttons.
FormFormComponentThe host router's form component, for those forms.
closeHrefstringClose as a link to this address (the list without ?inspect=), so it works with no script.
can{ trash?: boolean; delete?: boolean }What the footer offers. Trash and Restore by default; Delete only when given.
tools{ focus?: boolean; replace?: { accept: string; hint: string } | null; crop?: { src: string; asNew: boolean; inPlace: boolean; onSave: (file: File, how: "new" | "replace") => Promise<void>; } | null; keepsSize?: boolean; }The tools that change the picture itself, each offered only when given (site-api v0.10.0): the focal point (a form posting intent=focus with x and y in percent), replace (a multipart form posting intent=replace and file, with what it accepts in words), and crop (needs script: the editor reads src, the file's bytes on the page's own origin, and hands the crop to onSave). keepsSize: the site refuses a replacement of another size, so replace asks for the same size and a crop is only ever a new file.
onTool(form: FormData) => voidIn autosave mode the tools sit inside the inspector's own form, so they cannot be forms: their buttons hand the fields here instead (MediaLibrary posts them through submit).
more(kit: { Tool: NonNullable<MediaInspectorProps["Form"]>; ident: (intent: string) => ReactNode; base: string; }) => ReactNodeMore sections after the picture tools, built by the host from Tool (a form in form mode, a group that hands its fields to onTool inside the autosaving form) and ident(intent), the hidden fields every inspector form carries. MediaLibrary's credit, turns, history and suggestions.

Functions

FunctionSignatureDoes
useMediaMode(layout: { current: HTMLElement | null; }): MediaModeReads how the inspector sits ("pane" or "sheet") from the layout's container query, and follows it as the container resizes. Put the ref on the element with class cap-media-layout.
controllerFor(root: HTMLElement | null): MediaController | undefined
attachMedia(root: HTMLElement, options?: MediaOptions): MediaController
enhance(root?: ParentNode): () => voidAttaches to every [data-cap="media"] under root not yet attached (with the default save, a POST of the inspector's form). Returns a function that detaches them all.

CSS variables

VariableDefault
--cap-dialog-fromnone
--cap-dialog-tonone
--cap-focus-x50%
--cap-focus-y50%
--cap-media-modesheet
--cap-media-tile11rem

Parts and data attributes

ClassIs
.cap-mediathe root
.cap-media-acta part
.cap-media-checka part
.cap-media-check-boxa part
.cap-media-check-worda part
.cap-media-copieda part
.cap-media-copya part
.cap-media-counta part
.cap-media-crop-actionsa part
.cap-media-crop-bodya part
.cap-media-crop-canvasa part
.cap-media-crop-fieldsa part
.cap-media-doca part
.cap-media-emptya part
.cap-media-factsa part
.cap-media-field-forma part
.cap-media-flagsa part
.cap-media-focusa part
.cap-media-focus-fieldsa part
.cap-media-focus-framea part
.cap-media-focus-marka part
.cap-media-focus-previewsa part
.cap-media-forma part
.cap-media-grida part
.cap-media-groupa part
.cap-media-group-counta part
.cap-media-group-titlea part
.cap-media-inspectora part
.cap-media-layouta part
.cap-media-maina part
.cap-media-metaa part
.cap-media-namea part
.cap-media-notea part
.cap-media-opena part
.cap-media-previewa part
.cap-media-reasona part
.cap-media-savea part
.cap-media-searcha part
.cap-media-sectiona part
.cap-media-statea part
.cap-media-state-leada part
.cap-media-summary-notea part
.cap-media-tagsa part
.cap-media-thumba part
.cap-media-tilea part
.cap-media-titlea part
.cap-media-toola part
.cap-media-tool-actionsa part
.cap-media-toolbara part
.cap-media-useda part
.cap-media-used-emptya part
.cap-media-used-howa part
AttributeValues
data-activepresent or absent
data-cap-partsave-fallback
data-cap-readypresent or absent
data-inlinepresent or absent
data-placementpresent or absent
data-ratio16:9 1:1 4:5
data-selectedpresent or absent
data-sizel s
data-statebinned failed idle saved
data-tonecrit
data-viewlist
StateRead from
:checkedthe platform
:emptythe platform
:focus-visiblethe platform
:focus-withinthe platform
:hoverthe platform
:modalthe platform
[aria-disabled="true"]an attribute
[hidden]an attribute
[open]an attribute

Accessibility

KeyDoes
Tab, Shift TabInto the grid at the active tile, through that tile's controls (its checkbox, Retry or Restore), and out; then on to the inspector
Arrow keys, on a tileMove focus to the neighboring tile, in two dimensions; Left and Right wrap to the next row; Up and Down stop at the first and last row
Home, End, on a tileFirst, last file
Enter, on a tileOpens the inspector on it and moves focus to its alt text; a sheet opens modal; an uploading or failed tile opens nothing
Space, x, on a tileSelects or clears it (x is off while single keys are off)
Esc, in the gridClears the selection (the bulk bar's rule)
Alt and an arrow, in an inspector fieldPrevious or next file; the inspector follows and focus stays in the field
Esc, in an inspector fieldFocus returns to the active tile; in a sheet, closes it and returns focus to the tile
Enter, in the tag fieldAdds the tag; it saves
Enter on a tag chipRemoves the tag; it saves
Enter or Space on CopyCopies the address (or the Markdown, the HTML) and says so
Enter or Space on Retry, RestoreRetries the upload; restores the file, with Undo
  • A tile is a list item holding one named link (name, type and size, described by its flags), a named checkbox ("Select launch-hero.jpg"), and its state in words. An uploading tile's bar is a <progress> (role progressbar) named "Uploading" with aria-valuetext "62 percent of capsid-walkthrough.png uploaded". A failed tile names its reason, and Retry names the file.
  • The inspector is a dialog named by the file's name. Every field has a visible label and, where it helps, a description (what alt text is for, what decorative means). Alt text is disabled while Decorative is checked.
  • The save status is role="status"; a failure is role="alert"; the copy confirmation is role="status". All are in the page before they are used.
  • Color is never alone: every flag and status has a glyph and a word. Text is at 4.5:1 in both themes (the flags, the meta line, the help, the facts, the used-in links); the checkbox edge and the fields' edges are at 3:1.
  • Hit areas of the tile's controls are at least var(--target). The checkbox is always shown on a touch screen.
  • Forced colors: the active tile is outlined in Highlight, the checkbox box keeps its edge, the failure block keeps its border.
  • Reduced motion: nothing eases.