Radios that share a name form one group: Tab reaches the chosen one and the Arrow keys move the choice. A Field with role="radiogroup" names the group, with one horizontal Field per option.
.hfield-content holds an option's label and description, connected to the radio with aria-describedby.
Delivery
Starts delivering as soon as you publish.
Pick a date and time in your account's time zone.
<RadioGroup label="Delivery" name="delivery" defaultValue="now"> <Field orientation="horizontal" label="Send now" description="Starts delivering as soon as you publish." > <Radio value="now" /> </Field> <Field orientation="horizontal" label="Schedule" description="Pick a date and time in your account's time zone." > <Radio value="scheduled" /> </Field></RadioGroup>
<div class="hfield" role="radiogroup" aria-labelledby="delivery-label"> <span class="hlabel" id="delivery-label">Delivery</span> <div class="hfield" data-orientation="horizontal"> <input class="hradio" type="radio" name="delivery" id="delivery-now" value="now" aria-describedby="delivery-now-description" checked /> <div class="hfield-content"> <label class="hlabel" for="delivery-now">Send now</label> <p class="hdescription" id="delivery-now-description">Starts delivering as soon as you publish.</p> </div> </div> <div class="hfield" data-orientation="horizontal"> <input class="hradio" type="radio" name="delivery" id="delivery-scheduled" value="scheduled" aria-describedby="delivery-scheduled-description" /> <div class="hfield-content"> <label class="hlabel" for="delivery-scheduled">Schedule</label> <p class="hdescription" id="delivery-scheduled-description"> Pick a date and time in your account's time zone. </p> </div> </div></div>
Disabled
disabled dims an option, and its label turns gray, whether or not it's chosen.
<RadioGroup> renders the group: a Field with role="radiogroup", named by its label, that gives its radios one name. <Radio> renders the <input type="radio">; put each in a horizontal Field for its label and description. Other props are the group <div>'s, or the input's.
The name its radios submit under; generated when left out
value or defaultValue
The chosen radio's value; a controlled value is null while none is chosen
onValueChange
Called with the newly chosen value
required, disabled
Set on every radio in it
HTML
An <input class="hradio" type="radio">, with a <label for> per radio and the same name on every radio in a group. A group is a Field with role="radiogroup" and aria-labelledby, holding one horizontal Field per option. Load radio.css; field.css for the group and labels. It needs no script.
Hook
Effect
checked
Chosen
disabled
Dimmed, not-allowed cursor; its Field label turns gray