# Power Toggle Button

> A round power button that lights up with a cyan glow when switched on, using a hidden checkbox.

- Category: [CSS Buttons](https://copy-css.com/category/buttons)
- Tags: on off, glow, checkbox, switch, dark
- Live preview: https://copy-css.com/snippets/power-toggle-button
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<label class="btn-power">
  <input type="checkbox" aria-label="Power">
  <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v8"/><path d="M6.3 6.8a8 8 0 1 0 11.4 0"/></svg>
</label>
```

## CSS

```css
.btn-power {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1f2937, #111827);
  color: #4b5563;
  box-shadow:
    inset 0 1px 0 #374151,
    0 10px 24px #00000099;
  cursor: pointer;
  transition: color 0.3s ease, box-shadow 0.3s ease;
}

.btn-power input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.btn-power svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  pointer-events: none;
  transition: filter 0.3s ease;
}

.btn-power:hover {
  color: #6b7280;
}

.btn-power:has(input:checked) {
  color: #22d3ee;
  box-shadow:
    inset 0 1px 0 #374151,
    0 0 0 2px #22d3ee66,
    0 0 32px #22d3ee66;
}

.btn-power:has(input:checked) svg {
  filter: drop-shadow(0 0 6px #22d3ee);
}

.btn-power:has(input:focus-visible) {
  outline: 2px solid #67e8f9;
  outline-offset: 5px;
}
```

## Notes

- This CSS Power Toggle Button is 55 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses transitions, linear gradients, box shadows and filters.
- 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.
