CSS Checkbox Tiles

Large icon tiles for picking several options at once, each a real checkbox with a corner check badge.

  • checkbox
  • tiles
  • multi-select
  • icons
  • has
  • options grid
HTML
<fieldset class="check-tiles">
  <legend>What are you building?</legend>
  <label>
    <input type="checkbox" checked>
    <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="14" rx="2"/><path d="M8 21h8M12 18v3"/></svg>
    Website
  </label>
  <label>
    <input type="checkbox">
    <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 18h2"/></svg>
    Mobile app
  </label>
  <label>
    <input type="checkbox" checked>
    <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h10"/></svg>
    Docs
  </label>
</fieldset>
CSS
.check-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 300px;
  margin: 0;
  padding: 0;
  border: 0;
  font-family: system-ui, sans-serif;
}

.check-tiles legend {
  margin-bottom: 8px;
  padding: 0;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 700;
}

.check-tiles label {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 6px 12px;
  border: 1.5px solid #dbeafe;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.check-tiles svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.check-tiles input {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid #bfdbfe;
  border-radius: 50%;
  -webkit-appearance: none;
  appearance: none;
}

.check-tiles input:checked {
  border-color: #2563eb;
  background: #2563eb;
}

.check-tiles input:checked::before {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.check-tiles label:has(:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.check-tiles label:has(:focus-visible) {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

About this CSS Checkbox Tiles

This CSS Checkbox Tiles is 84 lines of pure CSS (1.5 KB) with no JavaScript and no dependencies. It uses transitions, CSS Grid, the :has() selector and the :checked state (no JavaScript). It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #1e3a8a
  • #dbeafe
  • #fff
  • #334155
  • #bfdbfe
  • #2563eb
  • #eff6ff
  • #1d4ed8

How to use this checkbox tiles

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .check-tiles class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback