# Checkbox Tiles

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

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: checkbox, tiles, multi-select, icons, has, options grid
- Live preview: https://copy-css.com/snippets/checkbox-tiles
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```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

```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;
}
```

## Notes

- 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).
- the :has() selector: Chrome 105+, Safari 15.4+, Firefox 121+.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
