Skip to the main content

Checkbox and Radio Styles

Free Forms

Styled native checkboxes, radio buttons, option cards and chip toggles that keep their keyboard behaviour, group labels and a strong focus ring.

Checked on 3 December 2026 in Chrome 143.0.7499.169: 12 automated checks. What the checks are

Preview and code

HTML

<section class="cr" aria-labelledby="cr-title">
  <h2 class="cr__title" id="cr-title">Checkboxes and radio buttons</h2>
  <p class="cr__lede">Native inputs, restyled. Space, arrow keys and the focus ring all behave as the browser intends.</p>

  <div class="cr__cols">
    <fieldset class="cr__set">
      <legend class="cr__legend">Send me updates about</legend>
      <label class="cr__row"><input class="cr__box" type="checkbox" name="cr-news" checked><span>New examples</span></label>
      <label class="cr__row"><input class="cr__box" type="checkbox" name="cr-news"><span>Tutorials</span></label>
      <label class="cr__row"><input class="cr__box" type="checkbox" name="cr-news" disabled><span>Paused topic (disabled)</span></label>
    </fieldset>

    <fieldset class="cr__set">
      <legend class="cr__legend">Delivery of the summary</legend>
      <label class="cr__row"><input class="cr__dot" type="radio" name="cr-when" value="daily" checked><span>Every day</span></label>
      <label class="cr__row"><input class="cr__dot" type="radio" name="cr-when" value="weekly"><span>Every week</span></label>
      <label class="cr__row"><input class="cr__dot" type="radio" name="cr-when" value="never"><span>Never</span></label>
    </fieldset>
  </div>

  <fieldset class="cr__set cr__set--cards">
    <legend class="cr__legend">Row spacing</legend>
    <div class="cr__cards">
      <label class="cr__card"><input class="cr__card-input" type="radio" name="cr-density" value="compact" checked><span class="cr__card-body"><span class="cr__lines cr__lines--tight" aria-hidden="true"><i></i><i></i><i></i><i></i></span><span class="cr__card-name">Compact</span><span class="cr__card-note">More rows per screen</span></span></label>
      <label class="cr__card"><input class="cr__card-input" type="radio" name="cr-density" value="comfortable"><span class="cr__card-body"><span class="cr__lines" aria-hidden="true"><i></i><i></i><i></i></span><span class="cr__card-name">Comfortable</span><span class="cr__card-note">A balance</span></span></label>
      <label class="cr__card"><input class="cr__card-input" type="radio" name="cr-density" value="roomy"><span class="cr__card-body"><span class="cr__lines cr__lines--loose" aria-hidden="true"><i></i><i></i></span><span class="cr__card-name">Roomy</span><span class="cr__card-note">Easier to tap</span></span></label>
    </div>
  </fieldset>

  <fieldset class="cr__set">
    <legend class="cr__legend">Topics</legend>
    <div class="cr__chips">
      <label class="cr__chip"><input class="cr__chip-input" type="checkbox" name="cr-topic" checked><span>Layout</span></label>
      <label class="cr__chip"><input class="cr__chip-input" type="checkbox" name="cr-topic"><span>Colour</span></label>
      <label class="cr__chip"><input class="cr__chip-input" type="checkbox" name="cr-topic" checked><span>Forms</span></label>
      <label class="cr__chip"><input class="cr__chip-input" type="checkbox" name="cr-topic"><span>Motion</span></label>
      <label class="cr__chip"><input class="cr__chip-input" type="checkbox" name="cr-topic"><span>Type</span></label>
    </div>
  </fieldset>
</section>

CSS

.cr {
  --cr-surface: #ffffff;
  --cr-ink: #1b2a24;
  --cr-muted: #4c5f57;
  --cr-line: #d5e0db;
  --cr-border: #5e7269;
  --cr-wash: #f1f6f3;
  --cr-accent: #0f7a5c;
  --cr-accent-ink: #ffffff;
  --cr-accent-wash: #e0f3ec;
  --cr-ring: #1b2a24;
  box-sizing: border-box;
  container-type: inline-size;
  width: min(100%, 40rem);
  padding: 1.5rem;
  color: var(--cr-ink);
  background: var(--cr-surface);
  border: 1px solid var(--cr-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgb(27 42 36 / 6%), 0 14px 32px -14px rgb(27 42 36 / 24%);
  font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.cr *, .cr *::before, .cr *::after { box-sizing: border-box; }
.cr__title { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.cr__lede { margin: 0.35rem 0 1.25rem; max-width: 32rem; font-size: 0.9rem; color: var(--cr-muted); }
.cr__cols { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.cr__set { min-width: 0; margin: 0 0 1.25rem; padding: 0; border: 0; }
.cr__cols .cr__set { margin: 0; }
.cr__legend { padding: 0; margin-bottom: 0.4rem; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cr-muted); }
.cr__row { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; cursor: pointer; }
.cr__row:has(:disabled) { color: var(--cr-muted); cursor: not-allowed; }

.cr__box, .cr__dot { flex: none; appearance: none; display: grid; place-items: center; width: 24px; height: 24px; margin: 0; background: var(--cr-surface); border: 2px solid var(--cr-border); cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease; }
.cr__box { border-radius: 7px; }
.cr__dot { border-radius: 50%; }
.cr__box::after { content: ""; width: 6px; height: 11px; margin-top: -2px; border: solid var(--cr-accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform 0.15s ease; }
.cr__dot::after { content: ""; width: 10px; height: 10px; background: var(--cr-accent-ink); border-radius: 50%; transform: scale(0); transition: transform 0.15s ease; }
.cr__box:checked, .cr__dot:checked { background: var(--cr-accent); border-color: var(--cr-accent); }
.cr__box:checked::after { transform: rotate(45deg) scale(1); }
.cr__dot:checked::after { transform: scale(1); }
.cr__box:disabled, .cr__dot:disabled { background: var(--cr-wash); border-style: dashed; cursor: not-allowed; }
.cr__row:hover .cr__box:not(:disabled):not(:checked), .cr__row:hover .cr__dot:not(:checked) { border-color: var(--cr-ink); }

.cr__cards { display: grid; gap: 0.6rem; }
.cr__card { position: relative; display: block; }
.cr__card-input { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; margin: 0; appearance: none; background: var(--cr-surface); border: 2px solid var(--cr-line); border-radius: 14px; cursor: pointer; }
.cr__card-input:checked { background: var(--cr-accent-wash); border-color: var(--cr-accent); }
.cr__card-body { position: relative; z-index: 1; display: grid; gap: 0.15rem; padding: 0.9rem 1rem; pointer-events: none; }
.cr__card-name { font-weight: 700; }
.cr__card-note { font-size: 0.8rem; color: var(--cr-muted); }
.cr__card-input:checked + .cr__card-body .cr__card-note { color: var(--cr-ink); }
.cr__card-body::after { content: ""; position: absolute; top: 0.8rem; right: 0.8rem; width: 1.15rem; height: 1.15rem; border: 2px solid var(--cr-border); border-radius: 50%; }
.cr__card-input:checked + .cr__card-body::after { background: radial-gradient(circle, var(--cr-accent-ink) 0 28%, var(--cr-accent) 32%); border-color: var(--cr-accent); }
.cr__lines { display: grid; gap: 4px; width: 3rem; margin-bottom: 0.5rem; }
.cr__lines i { height: 5px; background: var(--cr-border); border-radius: 3px; opacity: 0.75; }
.cr__lines--tight { gap: 2px; }
.cr__lines--loose { gap: 9px; }

.cr__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cr__chip { position: relative; display: inline-block; }
.cr__chip-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; appearance: none; background: transparent; border: 0; border-radius: 999px; cursor: pointer; }
.cr__chip span { position: relative; display: block; min-height: 40px; padding: 0.5rem 1rem; font-size: 0.9rem; font-weight: 600; background: var(--cr-surface); border: 2px solid var(--cr-border); border-radius: 999px; transition: background-color 0.15s ease; pointer-events: none; }
.cr__chip-input:checked + span { color: var(--cr-accent-ink); background: var(--cr-accent); border-color: var(--cr-accent); }
.cr__chip-input:checked + span::before { content: "\2713\00a0"; }

.cr__box:focus-visible, .cr__dot:focus-visible, .cr__card-input:focus-visible, .cr__chip-input:focus-visible { outline: 3px solid var(--cr-ring); outline-offset: 3px; }
@container (min-width: 30rem) {
  .cr__cols { grid-template-columns: 1fr 1fr; }
  .cr__cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 26rem) {
  .cr { padding: 1rem; }
}
@media (prefers-color-scheme: dark) {
  .cr {
    --cr-surface: #14211c; --cr-ink: #e9f3ee; --cr-muted: #a8bdb3; --cr-line: #2a4037; --cr-border: #8ba599; --cr-wash: #1b2d26;
    --cr-accent: #5fd6ae; --cr-accent-ink: #0b2a20; --cr-accent-wash: #1c3a30; --cr-ring: #e9f3ee;
    box-shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 16px 34px -14px rgb(0 0 0 / 70%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cr__box, .cr__dot, .cr__box::after, .cr__dot::after, .cr__chip span { transition: none; }
}
@media (forced-colors: active) {
  .cr__box, .cr__dot, .cr__chip-input, .cr__card-input { appearance: auto; }
  .cr__box::after, .cr__dot::after, .cr__card-body::after { display: none; }
}

Accessibility notes

Written by the author of the snippet. Each note has a test step or a markup check that reads the page.

  • Every group is a fieldset with a legend, and every input sits inside its label.
  • Space ticks a checkbox and the arrow keys move a radio selection.
  • The focus ring is an outline on the input itself, drawn clear of the shape.
  • In forced-colors mode the native controls come back.
Forms
Free

Text Inputs

Text, email, number, search and multi-line fields with a label, a hint and an error line tied to the field, switched on by the browser's own checks.

  • HTML
  • CSS
  • No library
  • Forms
  • Inputs