Skip to main content
The Radio component allows users to select exactly one option from a set of mutually exclusive choices.

Basic usage

<flx-radio-group [(ngModel)]="selectedOption">
  <flx-radio value="option1" label="Option 1"></flx-radio>
  <flx-radio value="option2" label="Option 2"></flx-radio>
  <flx-radio value="option3" label="Option 3"></flx-radio>
</flx-radio-group>

Radio button properties

label
string
Label text displayed next to the radio button
value
any
required
Value of this radio button option
disabled
boolean
default:"false"
Disables this radio button
checked
boolean
default:"false"
Whether this radio button is selected

Radio group properties

name
string
Name attribute for the radio group (auto-generated if not provided)
value
any
Currently selected value in the group
disabled
boolean
default:"false"
Disables all radio buttons in the group
required
boolean
default:"false"
Marks the group as required
orientation
'horizontal' | 'vertical'
default:"vertical"
Layout direction of radio buttons

Events

valueChange
EventEmitter<any>
Emitted when the selected value changes

Examples

<flx-radio-group
  [(ngModel)]="paymentMethod"
  orientation="vertical">
  <flx-radio value="card" label="Credit Card"></flx-radio>
  <flx-radio value="paypal" label="PayPal"></flx-radio>
  <flx-radio value="bank" label="Bank Transfer"></flx-radio>
</flx-radio-group>

<p>Selected: {{ paymentMethod }}</p>
export class PaymentComponent {
  paymentMethod = 'card';
}

Styling

flx-radio {
  --flx-radio-size: 18px;
  --flx-radio-border-color: #d1d5db;
  --flx-radio-checked-border-color: #3b82f6;
  --flx-radio-checked-background: #3b82f6;
  --flx-radio-dot-color: #ffffff;
  --flx-radio-disabled-opacity: 0.5;
  --flx-radio-spacing: 12px;
}

flx-radio-group {
  --flx-radio-group-gap: 12px;
}

Accessibility

The Radio component ensures full accessibility:
  • Arrow keys navigate between options in a group
  • Space key selects the focused option
  • role="radiogroup" and role="radio" for proper semantics
  • aria-checked reflects the selected state
  • aria-required for required groups
  • Proper label association
Radio buttons are best for 2-5 options. For more options, consider using a Select component instead.

Build docs developers (and LLMs) love