The Free Component Library · Volume 01

Useful Interface Details, Ready to Borrow.

Six dependency-free components with live states, practical notes, and source you can paste into an ordinary HTML file.

No framework No build step Motion tuned with transitions.dev
01 / 06

Liquid Glass Button

A refractive glass pill with a live WebGL chromatic-metal orb, a rotating gradient stroke, and an SVG lens that bends whatever sits behind it. One file, zero dependencies.

Use it for: the single action you want remembered. Chromium renders the full lens refraction; Safari and Firefox automatically get a frosted-glass fallback with the orb kept crisp.
LIVE · WEBGL ORB + SVG LENS · HOVER, PRESS, TAB

Copy the Source

HTML + one JS file (self-injects its CSS)
HTML
<script src="cm-liquid-button.js" defer></script>

<button data-lgb>Get started</button>
<button data-lgb data-lgb-preset="northern">Text me</button>

<!-- shader under the glass (original recipe) -->
<button data-lgb data-lgb-crisp="false">Warped orb</button>

<!-- full control from JS -->
<script>
  CMLiquidButton.upgrade(document.querySelector('#cta'), {
    gradient: ['#5c6168', '#f2f5f8', '#ffffff', '#545963'],
    orbSettings: { speed: 0.5, rgbSplit: 0.03 },
    glass: { refraction: 32, dispersion: 0.35 }
  });

  // SPA teardown: stops the loop, restores the button
  CMLiquidButton.destroy(document.querySelector('#cta'));
</script>

<!-- set label color per surface -->
<style>
  .my-dark-hero .lgb { --lgb-text: #fff; }
</style>
cm-liquid-button.js
Loading the source…
02 / 06

A focused navigation bar with a measured sliding indicator that stays readable over content and becomes solid when blur is unavailable.

Use it for: short navigation with a clear brand and two to four destinations. On small screens, hide lower-priority links instead of adding a fragile menu.
RESPONSIVE · BLUR FALLBACK INCLUDED

Copy the Source

HTML + CSS + JS
HTML
<nav class="cm-frost-nav" aria-label="Primary">
  <a class="cm-frost-nav__brand" href="/">Fieldnotes</a>
  <div class="cm-frost-nav__links">
    <span class="cm-frost-nav__pill" aria-hidden="true"></span>
    <a href="/work" aria-current="page">Work</a>
    <a href="/notes">Notes</a>
    <a href="/about">About</a>
  </div>
</nav>
CSS
Loading the source…
JavaScript
Loading the source…
03 / 06

Tactile Glass Card

A content surface with pointer-responsive tilt and glare whose depth makes interaction legible rather than merely decorative.

Use it for: a single linked story, project, or next step. Replace the anchor with an article when the card is not interactive, and remove the hover transform.
POINTER TILT · KEYBOARD + REDUCED MOTION INCLUDED

Copy the Source

HTML + CSS + JS
HTML
<div class="cm-glass-card-wrap">
  <a class="cm-glass-card" href="/notes/depth">
    <span class="cm-glass-card__glare" aria-hidden="true"></span>
    <span class="cm-glass-card__meta">Interface Note · 01</span>
    <strong class="cm-glass-card__title">
      Depth should clarify what can move.
    </strong>
    <span class="cm-glass-card__arrow">Read the note →</span>
  </a>
</div>
CSS
Loading the source…
JavaScript
Loading the source…
04 / 06

Glass Toggle

A switch with real weight: a sunken glass track, a springy thumb that squashes under press, and a checked state that changes color honestly.

Use it for: a binary setting that applies immediately. If the choice needs a save button, use a checkbox instead.
LIVE · CLICK, TAB + SPACE
Ambient sync
Weekly digest

Copy the Source

HTML + CSS + JS
HTML
<!-- the visible text IS the accessible name -->
<div class="cm-glass-toggle-row">
  <button class="cm-glass-toggle" type="button"
    role="switch" aria-checked="true"
    aria-labelledby="sync-label"></button>
  <span id="sync-label">Ambient sync</span>
</div>
CSS
Loading the source…
JavaScript
Loading the source…
05 / 06

Glass Input

A sunken glass field with a calm focus ring and an invalid state driven entirely by aria-invalid — accessibility and styling from the same attribute.

Use it for: one or two fields over a dark atmospheric surface. Long forms belong on a plain background where reading is cheap.
LIVE · FOCUS RING + INVALID STATE

That email address does not look valid.

Copy the Source

HTML + CSS
HTML
<div class="cm-glass-field">
  <label class="cm-glass-field__label" for="ws">
    Workspace name
  </label>
  <input class="cm-glass-input" id="ws"
    type="text" placeholder="northern-clearing">
</div>

<!-- invalid: set aria-invalid + describedby -->
<div class="cm-glass-field">
  <label class="cm-glass-field__label" for="email">
    Email address
  </label>
  <input class="cm-glass-input" id="email" type="email"
    aria-invalid="true" aria-describedby="email-error">
  <p class="cm-glass-field__error" id="email-error">
    That email address does not look valid.
  </p>
</div>
CSS
Loading the source…
06 / 06

Glass Dialog

A frosted modal built on the native <dialog> element — focus trap, Escape, inert background, and backdrop come from the platform, not from a library.

Use it for: one decision that must be answered before continuing. Anything a user can ignore should be a toast or an inline note, not a modal.
LIVE · NATIVE <dialog> · ESCAPE + OUTSIDE CLICK CLOSE

Clear this draft?

The draft goes away permanently. Anything already published stays exactly where it is.

Copy the Source

HTML + CSS + JS
HTML
<button type="button" data-dialog-open="confirm-dialog">
  Open the dialog
</button>

<dialog class="cm-glass-dialog" id="confirm-dialog"
  aria-labelledby="confirm-title">
  <div class="cm-glass-dialog__body">
    <h2 class="cm-glass-dialog__title" id="confirm-title">
      Clear this draft?
    </h2>
    <p class="cm-glass-dialog__copy">
      The draft goes away permanently.
    </p>
    <!-- method="dialog" buttons close natively -->
    <form method="dialog" class="cm-glass-dialog__actions">
      <button class="cm-glass-dialog__button"
        value="cancel">Keep it</button>
      <button class="cm-glass-dialog__button
        cm-glass-dialog__button--primary"
        value="confirm">Clear draft</button>
    </form>
  </div>
</dialog>
CSS
Loading the source…
JavaScript
Loading the source…

That’s Volume 01

More When They’re Worth Sharing.

I’ll add components when I have something genuinely reusable—not to make the grid look fuller.

Back to Casey’s site