v1.3.0 28

RadioGroup

A set of checkable buttons where only one can be checked at a time.

Interactive Requires: veritheme.js JS init: automatic

Default

html
<div data-vt-group="default" class="vt-space-y-3">
  <label class="vt-check-label" onclick="veritheme.selectRadio('default', this)">
    <div class="vt-radio selected"><div class="vt-dot"></div></div>
    Default
  </label>
  <label class="vt-check-label" onclick="veritheme.selectRadio('default', this)">
    <div class="vt-radio"><div class="vt-dot"></div></div>
    Comfortable
  </label>
  <label class="vt-check-label" onclick="veritheme.selectRadio('default', this)">
    <div class="vt-radio"><div class="vt-dot"></div></div>
    Compact
  </label>
</div>

With Description

Radio options with helper text.

html

Notification preferences

<p class="vt-label-md vt-mb-4">Notification preferences</p>
<div data-vt-group="notif" class="vt-space-y-4">
  <label class="vt-check-label" onclick="veritheme.selectRadio('notif', this)">
    <div class="vt-radio selected"><div class="vt-dot"></div></div>
    <span class="vt-check-label-content">
      <span class="vt-check-label-title">All notifications</span>
      <span class="vt-check-label-description">Get notified about everything.</span>
    </span>
  </label>
  <label class="vt-check-label" onclick="veritheme.selectRadio('notif', this)">
    <div class="vt-radio"><div class="vt-dot"></div></div>
    <span class="vt-check-label-content">
      <span class="vt-check-label-title">Mentions only</span>
      <span class="vt-check-label-description">Only get notified when someone mentions you.</span>
    </span>
  </label>
  <label class="vt-check-label" onclick="veritheme.selectRadio('notif', this)">
    <div class="vt-radio"><div class="vt-dot"></div></div>
    <span class="vt-check-label-content">
      <span class="vt-check-label-title">Nothing</span>
      <span class="vt-check-label-description">Turn off all notifications.</span>
    </span>
  </label>
</div>

Horizontal

html
<div data-vt-group="horiz" class="vt-flex vt-flex-wrap vt-gap-6">
  <label class="vt-check-label" onclick="veritheme.selectRadio('horiz', this)">
    <div class="vt-radio selected"><div class="vt-dot"></div></div>
    System
  </label>
  <label class="vt-check-label" onclick="veritheme.selectRadio('horiz', this)">
    <div class="vt-radio"><div class="vt-dot"></div></div>
    Light
  </label>
  <label class="vt-check-label" onclick="veritheme.selectRadio('horiz', this)">
    <div class="vt-radio"><div class="vt-dot"></div></div>
    Dark
  </label>
</div>

Disabled

html
<div class="vt-space-y-3">
  <label class="vt-check-label">
    <div class="vt-radio disabled selected"><div class="vt-dot"></div></div>
    Selected (disabled)
  </label>
  <label class="vt-check-label">
    <div class="vt-radio disabled"><div class="vt-dot"></div></div>
    Option (disabled)
  </label>
</div>

Guidelines

Do Use a radio group for a single choice among 2–5 visible options.
Don't Don't use radios for long lists — a select scales better.

API Reference

Class Type Description
vt-radio Base Radio button circle — border, size, transition
vt-dot Base Inner dot element inside the radio circle
selected State Selected state — fills dot and highlights border
disabled State Disabled state — no interaction allowed
vt-check-label Component Clickable row of a radio and its text (Body/SM), 12px apart
vt-check-label-content Part Stacks a title and a description; the row then aligns to the top
vt-check-label-title Part Title in Label/MD
vt-check-label-description Part Hint under the title — Body/SM, muted
vt-disabled State On vt-check-label: grays the text; automatic when the radio is .disabled or :disabled

Accessibility

Feature Details
Role Use native input[type="radio"] within a fieldset for built-in semantics
Group Wrap related radios in fieldset with legend describing the group
Keyboard Arrow keys move selection within group, Tab moves out of group
Label Each radio must have a visible label linked via for/id
Required If required, add aria-required="true" to the group