# Custom Radio Buttons

> Restyled native radio buttons with a dot that pops in, using appearance: none.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: radio, custom, appearance, form, options
- Live preview: https://copy-css.com/snippets/custom-radio
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="radios">
  <label><input type="radio" name="plan" checked> Starter</label>
  <label><input type="radio" name="plan"> Team</label>
  <label><input type="radio" name="plan"> Enterprise</label>
</div>
```

## CSS

```css
.radios {
  display: grid;
  gap: 12px;
  color: #27272a;
  font: 500 15px system-ui, sans-serif;
}

.radios label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.radios input {
  display: grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid #a1a1aa;
  border-radius: 50%;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.radios input::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.3, 1.6, 0.6, 1);
}

.radios input:hover {
  border-color: #71717a;
}

.radios input:checked {
  border-color: #10b981;
}

.radios input:checked::before {
  transform: scale(1);
}

.radios input:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}
```

## Notes

- This CSS Custom Radio Buttons is 54 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses transitions, transforms, CSS Grid and Flexbox.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
