Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
<app-radio-group> ├── [appRadioGroupLabel] (optional) └── <label appRadioGroupItem> ├── [appRadioGroupItemControl] │ └── generated indicator icon ├── [appRadioGroupItemText] └── <input appRadioGroupItemHiddenInput>
Examples
Default
Loading...
Grid
Loading...
Invalid
Loading...
List
Loading...
API Reference
<app-radio-group>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Unique identifier used to create the radio-group part IDs. |
ids | RadioGroupElementIds | undefined | — | Overrides the generated IDs for individual parts. |
value | string | null | undefined | — | Selected value when controlled. Supports Angular two-way binding. |
defaultValue | string | null | undefined | — | Initial selected value when uncontrolled. |
name | string | undefined | — | Name used when submitting the selected value with a form. |
form | string | undefined | — | Associates the radio group with a form by ID. |
disabled | boolean | false | Disables interaction with the radio group. |
invalid | boolean | false | Marks the radio group as invalid. |
required | boolean | false | Marks the radio group as required. |
readOnly | boolean | false | Prevents changes while preserving focus and navigation. |
orientation | RadioGroupOrientation | undefined | "horizontal" | Sets the component orientation and keyboard navigation axis. |
Use [(value)]="value" for two-way binding, or combine [value] with (valueChange) when using
signals. The component also implements Angular's ControlValueAccessor for forms integration.
Outputs
| Output | Type | Description |
|---|---|---|
valueChange | string | null | undefined | Emits the current selected value. |
valueDetailsChange | RadioGroupValueChangeDetails | Emits details whenever the selected value changes. |
<label appRadioGroupItem>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
value | string | required | Value represented by this radio-group item. |
disabled | boolean | false | Disables interaction with this item. |
invalid | boolean | false | Marks this item as invalid. |
Context, Providers, and Utilities
| Export | Angular API |
|---|---|
RadioGroupRootProvider | Directive that provides an externally created radio-group API through value. |
RadioGroupContext | Structural directive [radio-group-context] exposing the root API to a template. |
RadioGroupItemContextDirective | Structural directive [radio-group-item-context] exposing item state. |
useRadioGroup(options) | Creates the signal-backed radio-group machine inside an injection context. |
injectRadioGroupContext() | Injects the nearest radio-group root context. |
injectRadioGroupItemContext() | Injects the nearest radio-group item state. |
injectRadioGroupItemPropsContext() | Injects the nearest radio-group item props. |
RadioGroupImports | Readonly collection containing the radio-group UI and context helpers. |
Types
| Export | Description |
|---|---|
RadioGroupApi | Connected radio-group state and actions. |
RadioGroupElementIds | Overrides for generated radio-group part IDs. |
RadioGroupItemProps | Props used to derive the state of a radio-group item. |
RadioGroupItemState | Derived state for a radio-group item. |
RadioGroupOrientation | Keyboard navigation axis: "horizontal" or "vertical". |
RadioGroupValueChangeDetails | Details emitted by valueDetailsChange. |
UseRadioGroupOptions | Options accepted by useRadioGroup. |
UseRadioGroupProps | Root props accepted by the radio-group machine. |
UseRadioGroupReturn | Signal-backed radio-group machine returned by useRadioGroup. |
Angular
React
Solid
Svelte
Vue