AppRadio
Pick exactly one of a few exclusive options, every choice visible at once.
<app-radio label="1 year" name="exp" value="1" />A radio group asks the user to pick exactly one of a small set of options — an experience level, a plan, a shipping speed — with every choice on screen at once. Selecting one clears the rest, so the answer is always unambiguous.
Its look comes entirely from the shared @webority/theme, so the Razor <app-radio> and the React <AppRadio> render identically — a radio is a radio on every Webority surface.
Playground
Every attribute, live. Each change re-renders the real tag helper on the server, so the markup underneath is the exact call that produced the radio above it.
Exclusive choice
Radios that share a name form one group; picking any option deselects the others. Bind checked / onChange against a single value.
Show code
<div class="wui-control-group">
<app-radio label="No experience" name="exp" value="none" />
<app-radio label="1 year" name="exp" value="1" checked="true" />
<app-radio label="2+ years" name="exp" value="2" />
</div>
name. Give each group its own name — reuse a name across unrelated questions and picking an answer to one silently clears the other.Validation
Show a hint for guidance and an error when validation fails, on any radio in the group. They share one slot below the control — the error replaces the hint, matching app-input.
Show code
<app-radio label="1 year" name="exp" value="1" hint="Rounded to the nearest year." /> <app-radio label="1 year" name="exp" value="1" error="Choose an experience level." />
When to use
Use it when
- The user must pick exactly one of 2–5 mutually exclusive options.
- The options are short labels worth comparing at a glance, all visible.
- A single choice is mandatory before the form can be submitted.
Reach for something else when
- There are more than about five options. → AppSelect
- Each option needs a description or icon. → AppChoiceCard
- The choices are independent on/off settings. → AppCheckbox
- The user can pick several values. → AppMultiSelect
Best practices
Every option
The whole surface of the component, one cell per value — every state, the validation slot, and the content edge cases a normal example doesn't show.
state
(default)checkeddisableddisabled checkedvalidation
hinterrorhint + error (error wins)content
label omitted — bare control, no accessible namelong label — wraps inside the control groupAttributes
| Attribute | Type | Default | Description |
|---|---|---|---|
| label | string | — | The clickable label beside the radio. |
| id | string | — | Explicit input id — binds the label's for to it. Declared property, matching React's id. Auto-generated + uniquified per radio when omitted. |
| asp-for | ModelExpression | — | Razor-only. Binds name, id, checked state and validation message from a Razor Pages model property. |
| name * | string | — | Group name — radios sharing a name are mutually exclusive. |
| value | string | — | Submitted value when this radio is selected. |
| checked | bool | false | Renders this option as the selection. |
| error | string | — | Error message below the control. Turns aria-invalid true and replaces the hint. |
| hint | string | — | Helper text below the control. Hidden while an error is shown. |
| disabled | bool | false | Disables this option. Declared property, matching React's disabled. |