Components/Forms/Radio Group
COMPONENT08.08

Radio Group

Native radios grouped by name. Fieldset/legend titles the group; [data-field] carries hints and errors.


INSTALL

1pnpm dlx @sayagodev/mo add form

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/form.css";

EXAMPLES

Basic
With descriptions
Standard spacing for most use cases.
More space between elements.
Minimal spacing for dense layouts.
Disabled item
Fieldset with hint
Subscription Plan

Yearly and lifetime plans offer significant savings.

Invalid group
Notification Preferences

Choose how you want to receive notifications.

Select a notification preference to continue.
Choice cards

USAGE

1<fieldset>2  <legend>Subscription plan</legend>3  <div class="vstack gap-2 mt-2">4    <label><input type="radio" name="plan" checked /> Monthly</label>5    <label><input type="radio" name="plan" /> Yearly</label>6  </div>7</fieldset>

API

NAMEKINDDESCRIPTION
input[type=radio]elementRound dot indicator
nameattributeGroups radios natively
fieldset / legendelementTitled group container
[data-field] + small.errorclassGroup error reveal on invalid

FILES

src/css/form.css
Install:mo add form

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--background--border--destructive--foreground--input--muted--muted-foreground--primary--primary-foreground--radius--ring
Component hooks
--mo-field-gap--mo-input-padding-x--mo-input-radius--mo-slider-thumb-bg--mo-switch-thumb--mo-switch-width

Preview

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.