Radio group
vig-radio-group ng-template[vigSelectOption]
import { RadioGroup } from '@vigdx/ui/radio-group';
import { SelectOptionTemplate } from '@vigdx/ui/select';Basic
options as SelectOption objects ( value , label , optional icon and disabled ) and bind [(value)] . Values are compared with === ; the value is null while nothing is chosen.
You can change plans at any time.
Selected: team
Horizontal
orientation="horizontal" lays the options out in a wrapping row. An option with disabled: true is skipped by the arrow keys.
Custom option template
<ng-template vigSelectOption let-option> replaces the default icon and label of each option, here with a second line of detail. The text stays inside the radio's label.
Disabled, read-only and error
disabled disables every radio. readonly keeps them focusable but puts the checked state back after each change. Errors show once the group is touched and invalid .
Reactive Forms
VigValueAccessor next to the component to use formControlName , [formControl] or ngModel . The group counts as touched once focus leaves all of its radios.
Signal Forms
vig-radio-group implements FormValueControl<T | null> , where T is the type of the option values.
Valid: no · no plan, monthly
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="radio-group"][data-part="group"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="radio-group"]
| Part | Element | data-state |
|---|---|---|
group | <fieldset role="radiogroup"> . | — |
label | <legend> . | — |
options | — | |
option | <label> . | checked, unchecked |
control | — | |
input | — | |
indicator | — | |
option-label | — | |
hint | vig-hint (a display: contents host; style its text part). | — |
disabled-reason | vig-hint with the disabled reason ( display: contents ). | — |
error | vig-field-error (a display: contents host; style its message part). | — |
Accessibility
- Native
<input type="radio">elements share onename(generated when you do not set one), so the group is a single tab stop and the arrow keys move and select, mirrored under right-to-left. - The options sit in a native
<fieldset>whose<legend>is the visiblelabel; it keepsrole="radiogroup"for the group states below. Without a visible label, passariaLabel. required,readonlyand an invalid state setaria-required,aria-readonlyandaria-invalidon the group; hint and error are linked througharia-describedby.- Each option label is a
<label>around its radio, so clicking the text selects the option, also with a custom template.
API
RadioGroup
vig-radio-groupClassic radio list for an exclusive choice among a handful of visible
options. Each option is a native <input type="radio"> sharing one name,
so arrow keys, the single tab stop and form semantics come from the
browser. For a compact segmented look use vig-select-button.
| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | undefined | undefined | — |
dirty | boolean | false | — |
disabled | boolean | false | — |
disabledReasons | readonly WithOptionalFieldTree<DisabledReason>[] | [] | — |
errorMessages | Record<string, string> | — | — |
errors | readonly ValidationError.WithOptionalFieldTree[] | [] | — |
hidden | boolean | false | — |
hint | string | undefined | undefined | — |
invalid | boolean | false | — |
label | string | '' | Visible group label; omit it and pass |
name | string | '' | — |
options | readonly SelectOption<T>[] | [] | — |
orientation | RadioGroupOrientation | 'vertical' | — |
pending | boolean | false | — |
readonly | boolean | false | — |
required | boolean | false | — |
touched | boolean | false | — |
value | T | null | null | — |
| Name | Payload | Description |
|---|---|---|
touch | void | — |
valueChange | T | null | — |
| Signature | Description |
|---|---|
focus(options?: FocusOptions): void | Moves focus to the control's interactive element (the input, or the
trigger of a popup control). Signal Forms calls it through
|
reset(): void | Returns the control to its pristine look: drops in-progress text, closes
an open popup, clears errors the component raised itself and the
submitted state of |
SelectOptionTemplate
ng-template[vigSelectOption]Custom rendering for options of vig-select, vig-multi-select,
vig-listbox and vig-select-button, replacing the default icon + label. vig-select also
uses it for the selected value shown in the trigger.
Bind the same options to vigSelectOptionOf (like ngForOf) to type
let-option in the template; without it the option value is unknown.
<vig-select label="Status" [options]="statuses">
<ng-template vigSelectOption [vigSelectOptionOf]="statuses" let-option>
<i [class]="option.value" aria-hidden="true"></i> {{ option.label }}
</ng-template>
</vig-select>| Name | Type | Default | Description |
|---|---|---|---|
vigSelectOptionOf | readonly SelectOption<T>[] | null | undefined | undefined | Type-only: the options the template renders, so the template type checker infers the option value type. Not read at runtime. |
VigValueAccessor
Bridges the vigdx form fields to Reactive Forms (formControl,
formControlName) and template-driven forms (ngModel). Import it next to
the component; Signal Forms ([formField]) need no accessor.
| Signature | Description |
|---|---|
registerOnChange(fn: (value: unknown) => void): void | — |
registerOnTouched(fn: () => void): void | — |
setDisabledState(disabled: boolean): void | — |
writeValue(value: unknown): void | — |