29 CSS Checkboxes12 / 29
Neumorphic Checkbox
Soft-UI 'clay' controls: the box appears extruded from the surface, then presses inward when checked — created entirely with paired light and dark shadows on a single tonal background. The signature look of calm, monochrome dashboards.
Published Updated
The code
<section class="cb-12" aria-label="Neumorphic checkboxes">
<div class="cb-12__panel">
<label class="cb-12__row"><input type="checkbox" class="cb-12__input" checked><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Silent mode</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Haptic feedback</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Battery saver</span></label>
</div>
</section><section class="cb-12" aria-label="Neumorphic checkboxes">
<div class="cb-12__panel">
<label class="cb-12__row"><input type="checkbox" class="cb-12__input" checked><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Silent mode</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Haptic feedback</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Battery saver</span></label>
</div>
</section>.cb-12,
.cb-12 *,
.cb-12 *::before,
.cb-12 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cb-12 ::selection {
background: oklch(0.62 0.15 265);
color: #fff;
}
.cb-12 {
--surface: #e6e9ef;
--accent: oklch(0.58 0.16 265);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
padding: 40px 20px;
background: var(--surface);
display: flex;
align-items: center;
justify-content: center;
}
.cb-12__panel {
width: min(400px,100%);
display: flex;
flex-direction: column;
gap: 6px;
padding: 20px;
border-radius: 22px;
background: var(--surface);
box-shadow: 9px 9px 20px #c4c9d3,-9px -9px 20px #ffffff;
}
.cb-12__row {
display: flex;
align-items: center;
gap: 16px;
cursor: pointer;
padding: 12px 10px;
}
.cb-12__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.cb-12__box {
position: relative;
flex: none;
width: 30px;
height: 30px;
border-radius: 9px;
background: var(--surface);
box-shadow: 4px 4px 8px #c4c9d3,-4px -4px 8px #ffffff;
transition: box-shadow .3s ease;
}
.cb-12__box::after {
content: "";
position: absolute;
inset: 0;
background: var(--accent);
opacity: 0;
transform: scale(.5);
transition: opacity .25s,transform .25s cubic-bezier(.2,.9,.3,1.2);
-webkit-mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.cb-12__input:checked ~ .cb-12__box {
box-shadow: inset 4px 4px 8px #c4c9d3,inset -4px -4px 8px #ffffff;
}
.cb-12__input:checked ~ .cb-12__box::after {
opacity: 1;
transform: scale(1);
}
.cb-12__input:focus-visible ~ .cb-12__box {
outline: 3px solid var(--accent);
outline-offset: 4px;
}
.cb-12__label {
font-size: 14.5px;
font-weight: 500;
color: #59606e;
}
@media (prefers-reduced-motion: reduce) {
.cb-12__box,
.cb-12__box::after {
transition: none;
}
}.cb-12,
.cb-12 *,
.cb-12 *::before,
.cb-12 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cb-12 ::selection {
background: oklch(0.62 0.15 265);
color: #fff;
}
.cb-12 {
--surface: #e6e9ef;
--accent: oklch(0.58 0.16 265);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
padding: 40px 20px;
background: var(--surface);
display: flex;
align-items: center;
justify-content: center;
}
.cb-12__panel {
width: min(400px,100%);
display: flex;
flex-direction: column;
gap: 6px;
padding: 20px;
border-radius: 22px;
background: var(--surface);
box-shadow: 9px 9px 20px #c4c9d3,-9px -9px 20px #ffffff;
}
.cb-12__row {
display: flex;
align-items: center;
gap: 16px;
cursor: pointer;
padding: 12px 10px;
}
.cb-12__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.cb-12__box {
position: relative;
flex: none;
width: 30px;
height: 30px;
border-radius: 9px;
background: var(--surface);
box-shadow: 4px 4px 8px #c4c9d3,-4px -4px 8px #ffffff;
transition: box-shadow .3s ease;
}
.cb-12__box::after {
content: "";
position: absolute;
inset: 0;
background: var(--accent);
opacity: 0;
transform: scale(.5);
transition: opacity .25s,transform .25s cubic-bezier(.2,.9,.3,1.2);
-webkit-mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.cb-12__input:checked ~ .cb-12__box {
box-shadow: inset 4px 4px 8px #c4c9d3,inset -4px -4px 8px #ffffff;
}
.cb-12__input:checked ~ .cb-12__box::after {
opacity: 1;
transform: scale(1);
}
.cb-12__input:focus-visible ~ .cb-12__box {
outline: 3px solid var(--accent);
outline-offset: 4px;
}
.cb-12__label {
font-size: 14.5px;
font-weight: 500;
color: #59606e;
}
@media (prefers-reduced-motion: reduce) {
.cb-12__box,
.cb-12__box::after {
transition: none;
}
}/* No JavaScript — raised box-shadows swap to inset on :checked for the pressed look. */
/* No JavaScript — raised box-shadows swap to inset on :checked for the pressed look. */Here's a working CSS Checkboxe from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Neumorphic Checkbox
Source: https://codefronts.com/components/css-checkboxes/neumorphic-checkbox/
Soft-UI 'clay' controls: the box appears extruded from the surface, then presses inward when checked — created entirely with paired light and dark shadows on a single tonal background. The signature look of calm, monochrome dashboards.
## HTML
```html
<section class="cb-12" aria-label="Neumorphic checkboxes">
<div class="cb-12__panel">
<label class="cb-12__row"><input type="checkbox" class="cb-12__input" checked><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Silent mode</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Haptic feedback</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Battery saver</span></label>
</div>
</section>
```
## CSS
```css
.cb-12,
.cb-12 *,
.cb-12 *::before,
.cb-12 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cb-12 ::selection {
background: oklch(0.62 0.15 265);
color: #fff;
}
.cb-12 {
--surface: #e6e9ef;
--accent: oklch(0.58 0.16 265);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
padding: 40px 20px;
background: var(--surface);
display: flex;
align-items: center;
justify-content: center;
}
.cb-12__panel {
width: min(400px,100%);
display: flex;
flex-direction: column;
gap: 6px;
padding: 20px;
border-radius: 22px;
background: var(--surface);
box-shadow: 9px 9px 20px #c4c9d3,-9px -9px 20px #ffffff;
}
.cb-12__row {
display: flex;
align-items: center;
gap: 16px;
cursor: pointer;
padding: 12px 10px;
}
.cb-12__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.cb-12__box {
position: relative;
flex: none;
width: 30px;
height: 30px;
border-radius: 9px;
background: var(--surface);
box-shadow: 4px 4px 8px #c4c9d3,-4px -4px 8px #ffffff;
transition: box-shadow .3s ease;
}
.cb-12__box::after {
content: "";
position: absolute;
inset: 0;
background: var(--accent);
opacity: 0;
transform: scale(.5);
transition: opacity .25s,transform .25s cubic-bezier(.2,.9,.3,1.2);
-webkit-mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.cb-12__input:checked ~ .cb-12__box {
box-shadow: inset 4px 4px 8px #c4c9d3,inset -4px -4px 8px #ffffff;
}
.cb-12__input:checked ~ .cb-12__box::after {
opacity: 1;
transform: scale(1);
}
.cb-12__input:focus-visible ~ .cb-12__box {
outline: 3px solid var(--accent);
outline-offset: 4px;
}
.cb-12__label {
font-size: 14.5px;
font-weight: 500;
color: #59606e;
}
@media (prefers-reduced-motion: reduce) {
.cb-12__box,
.cb-12__box::after {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — raised box-shadows swap to inset on :checked for the pressed look. */
```Here's a working CSS Checkboxe from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Neumorphic Checkbox
Source: https://codefronts.com/components/css-checkboxes/neumorphic-checkbox/
Soft-UI 'clay' controls: the box appears extruded from the surface, then presses inward when checked — created entirely with paired light and dark shadows on a single tonal background. The signature look of calm, monochrome dashboards.
## HTML
```html
<section class="cb-12" aria-label="Neumorphic checkboxes">
<div class="cb-12__panel">
<label class="cb-12__row"><input type="checkbox" class="cb-12__input" checked><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Silent mode</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Haptic feedback</span></label>
<label class="cb-12__row"><input type="checkbox" class="cb-12__input"><span class="cb-12__box" aria-hidden="true"></span><span class="cb-12__label">Battery saver</span></label>
</div>
</section>
```
## CSS
```css
.cb-12,
.cb-12 *,
.cb-12 *::before,
.cb-12 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cb-12 ::selection {
background: oklch(0.62 0.15 265);
color: #fff;
}
.cb-12 {
--surface: #e6e9ef;
--accent: oklch(0.58 0.16 265);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
padding: 40px 20px;
background: var(--surface);
display: flex;
align-items: center;
justify-content: center;
}
.cb-12__panel {
width: min(400px,100%);
display: flex;
flex-direction: column;
gap: 6px;
padding: 20px;
border-radius: 22px;
background: var(--surface);
box-shadow: 9px 9px 20px #c4c9d3,-9px -9px 20px #ffffff;
}
.cb-12__row {
display: flex;
align-items: center;
gap: 16px;
cursor: pointer;
padding: 12px 10px;
}
.cb-12__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.cb-12__box {
position: relative;
flex: none;
width: 30px;
height: 30px;
border-radius: 9px;
background: var(--surface);
box-shadow: 4px 4px 8px #c4c9d3,-4px -4px 8px #ffffff;
transition: box-shadow .3s ease;
}
.cb-12__box::after {
content: "";
position: absolute;
inset: 0;
background: var(--accent);
opacity: 0;
transform: scale(.5);
transition: opacity .25s,transform .25s cubic-bezier(.2,.9,.3,1.2);
-webkit-mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.cb-12__input:checked ~ .cb-12__box {
box-shadow: inset 4px 4px 8px #c4c9d3,inset -4px -4px 8px #ffffff;
}
.cb-12__input:checked ~ .cb-12__box::after {
opacity: 1;
transform: scale(1);
}
.cb-12__input:focus-visible ~ .cb-12__box {
outline: 3px solid var(--accent);
outline-offset: 4px;
}
.cb-12__label {
font-size: 14.5px;
font-weight: 500;
color: #59606e;
}
@media (prefers-reduced-motion: reduce) {
.cb-12__box,
.cb-12__box::after {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — raised box-shadows swap to inset on :checked for the pressed look. */
```How this works
Neumorphism is all about matched shadow pairs on a background that's the same colour as the element. The unchecked box sits raised: a light shadow to the top-left and a dark shadow to the bottom-right make it read as extruded. On :checked the box swaps to matching inset shadows, so it appears pressed into the surface, and an accent check fades in.
The shadow swap is the whole effect — no colour change is required, though a subtle accent tint helps confirm state. Motion is limited to opacity/box-shadow crossfades. The input stays sr-only and focusable with a soft :focus-visible ring.
Because contrast is inherently low in soft-UI, the accent check is the primary state cue for accessibility — never rely on the shadow alone.
Make it yours
- Set the surface + shadows from one base tone; light and dark shadows should be equal offsets in opposite corners.
- Increase depth with larger shadow offsets/blur.
- Recolour the accent check via
--accent. - Match the page background to the box for the true soft-UI illusion.
Gotchas — read before shipping
- Soft-UI is low-contrast by nature — always include a clear coloured check so the state passes accessibility.
- The element and its background must share a tone or the extruded illusion breaks.
- Keep offsets modest on small controls or the shadows muddy together.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 15.4+ | 113+ | 111+ |
Floor set by oklch() as this demo is written. The core technique itself goes back further — Chrome 49+.
Multiple + inset box-shadows are universally supported.