Skip to main content

Radio Component

Last updated:

CSS-only Tailwind CSS radio buttons with primary, secondary, accent, and semantic color variants. Sizes xs-xl. WCAG AA accessible, works with Django, HTMX, Laravel, React, and any stack.

Radio button components allow users to select exactly one option from a set of mutually exclusive choices. Built with native HTML input elements and enhanced with Tailwind CSS, radio buttons support multiple sizes, colors, and states. Accessible and keyboard-navigable, radios are ideal for preference selection, filtering, and single-choice form questions.

CSS-only, no JavaScript required. WCAG AA accessible and framework-agnostic: works with Django, HTMX, Laravel, React, and any stack.

ClassTypeDescription
radioBaseStyled radio button input
radio-circleStyleFully circular radio (default)
radio-roundedStyleModerately rounded radio
radio-squareStyleSquare radio with no rounding
radio-disabledModifierDisabled appearance for non-input elements
radio-xsSizeExtra small
radio-smSizeSmall
radio-mdSizeMedium (default)
radio-lgSizeLarge
radio-xlSizeExtra large
radio-2xlSize2× extra large
radio-primaryColorPrimary theme color
radio-secondaryColorSecondary theme color
radio-accentColorAccent theme color
radio-neutralColorNeutral theme color
radio-infoColorInfo semantic color
radio-successColorSuccess semantic color
radio-warningColorWarning semantic color
radio-errorColorError semantic color

Basic Usage

1
2
<input type="radio" name="radio-1" class="radio" checked="checked">
<input type="radio" name="radio-1" class="radio">
1
2
<input type="radio" name="radio-1" className="radio" checked="checked">
<input type="radio" name="radio-1" className="radio">

Radio Sizes

html
1
2
3
4
5
<input type="radio" name="radio-sizes" class="radio radio-xs" checked="checked">
<input type="radio" name="radio-sizes" class="radio radio-sm" checked="checked">
<input type="radio" name="radio-sizes" class="radio radio-md" checked="checked">
<input type="radio" name="radio-sizes" class="radio radio-lg" checked="checked">
<input type="radio" name="radio-sizes" class="radio radio-xl" checked="checked">

Radio Colors

html
1
2
3
4
5
6
7
8
9
<input type="radio" name="radio-colors" class="radio" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-primary" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-secondary" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-accent" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-info" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-success" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-warning" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-error" checked="checked">
<input type="radio" name="radio-colors" class="radio radio-neutral" checked="checked">

Disabled radio

html
1
2
<input type="radio" class="radio" disabled="">
<input type="radio" class="radio" disabled="" checked="checked">

Radio Shapes

Square Radio

html
<input type="radio" name="shape-demo" class="radio radio-square" checked="checked">

Rounded or Circle Radio

html
1
2
<input type="radio" name="shape-demo2" class="radio radio-circle" checked="checked">
<input type="radio" name="shape-demo2" class="radio radio-rounded" checked="checked">

Radio with label

html
1
2
3
4
5
6
7
8
<input type="radio" class="radio radio-circle radio-neutral radio-sm" id="size-small" name="size" value="small">
<label for="size-small">Small</label>

<input type="radio" class="radio radio-circle radio-neutral radio-sm" id="size-medium" name="size" value="medium">
<label for="size-medium">Medium</label>

<input type="radio" class="radio radio-circle radio-neutral radio-sm" id="size-large" name="size" value="large">
<label for="size-large">Large</label>

Using Claude Code, Cursor, or another AI editor?

Cherry MCP gives your AI editor the exact Radio class names and structure on demand. No more hallucinated classes.

Try Cherry MCP

Found this useful?

Star Frutjam on GitHub. It's how other developers discover it.