Radio Group
Native radio group with options, helper/error text, orientation, and Angular forms support.
- Selector
- ui-radio-group
- Package
- @ngnova/ui/radio
Import
import { UiRadioGroupComponent } from '@ngnova/ui/radio';Usage & variants
Live examples use the public ui-radio-group API, paired with the exact snippet a product team would paste into an Angular app.
Contact preference
Native radio group with options, helper/error text, orientation, and Angular forms support.
Small mutually exclusive choices stay visible.
Production guidance
Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.
When to use
Use when all choices should be visible and the user must compare them.
Watch for
Avoid radio groups with too many options; use Select for long lists.
Product recipes
Apply Radio Group in distinct, copyable product scenarios—not just an isolated component state.
Preference group
Use helper text for context and keep parent form state in control.
1 2 3 4 5 6 7 8 9 10 11 12 13
<ui-radio-group
label="Contact preference"
helperText="Use helper text to clarify tradeoffs."
[options]="contactOptions"
[formControl]="contactPreference"
/>
<ui-radio-group
label="Layout density"
orientation="horizontal"
[options]="layoutOptions"
[formControl]="layoutDensity"
/>Billing cadence
Present mutually exclusive billing choices with concise pricing context in one named group.
1 2 3 4
<ui-radio-group label="Billing cadence" [formControl]="billingCadence">
<ui-radio value="monthly" label="Monthly" helperText="$24 per month" />
<ui-radio value="annual" label="Annual" helperText="$240 per year — save $48" />
</ui-radio-group>API Reference
Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.
Inputs
label '' string Visible group label.
helperText '' string Support text shown below the group.
errorText '' string Error text shown below the group.
ariaLabel '' string Accessible group label when no visible legend is provided.
name '' string Native radio name. Defaults to the generated group ID.
groupId generated string Base ID used for group description wiring.
orientation 'vertical' 'vertical' | 'horizontal' Radio option layout direction.
options [] readonly UiRadioOption[] Radio options rendered as native input elements.
disabled false boolean Disables the whole radio group.
required false boolean Marks radio options as required.
| Name | Type | Default | Description |
|---|---|---|---|
label | string | '' | Visible group label. |
helperText | string | '' | Support text shown below the group. |
errorText | string | '' | Error text shown below the group. |
ariaLabel | string | '' | Accessible group label when no visible legend is provided. |
name | string | '' | Native radio name. Defaults to the generated group ID. |
groupId | string | generated | Base ID used for group description wiring. |
orientation | 'vertical' | 'horizontal' | 'vertical' | Radio option layout direction. |
options | readonly UiRadioOption[] | [] | Radio options rendered as native input elements. |
disabled | boolean | false | Disables the whole radio group. |
required | boolean | false | Marks radio options as required. |
Outputs
valueChange OutputEmitterRef<string> Emits the selected value after user interaction.
focused OutputEmitterRef<FocusEvent> Emits when a radio receives focus. The host also forwards a native focus event.
blurred OutputEmitterRef<FocusEvent> Emits when a radio loses focus. The host also forwards a native blur event.
| Name | Type | Description |
|---|---|---|
valueChange | OutputEmitterRef<string> | Emits the selected value after user interaction. |
focused | OutputEmitterRef<FocusEvent> | Emits when a radio receives focus. The host also forwards a native focus event. |
blurred | OutputEmitterRef<FocusEvent> | Emits when a radio loses focus. The host also forwards a native blur event. |
Accessibility
- Uses native radio inputs grouped by name and labelled by visible text.
- Helper and error text are associated with the group.
- Provide ariaLabel when the group does not render a visible label/legend.
Keyboard behavior
- Arrow keys move between radios in native browser behavior.
- Space selects the focused option.
Testing guidance
- Assert selection, disabled options, CVA, and orientation classes.