The RadioButton enables you to style
input type="radio" elements.
The RadioButton lets the user create multiple inputs with separate values tied to a single model value by sharing the same
name attribute. All regular <input type="radio"> HTML attributes and Angular bindings are applicable.
The RadioButton can be associated with an HTML
label element like any regular
<input type="radio"> element or with the Label component.
You can use the RadioButton in template-driven or reactive forms.
The template-driven forms enable you to bind the RadioButton to the forms model by using the
The following example demonstrates how to use the RadioButton in a template-driven form.
FormGroup provides a way to render reactive forms. For more details, refer to the Angular Documentation.
The following example demonstrates how to use the RadioButton in a reactive form.
The following example demonstrates how to use the RadioButton within a FormField component and provide hint and error messages.
The FormField automatically inserts the label before any form control. In order to position radio button before label, the two elements should be nested within a wrapper element.
You can make the RadioButton required.
To do so use one of the following:
By default, the RadioButton is enabled.
To disable user interaction with the element, use the
disabled attribute or Angular property binding.