---
title: "Angular Forms Radio buttons Example | Mobiscroll"
component: "Forms"
framework: "Angular"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/angular/forms/radio-button"
---

# Radio buttons - Angular Forms demo

Angular radio button demo for single select option lists. Use it with or without description, supports disabled styling. For Angular 22 and Ionic 8.

- [Live demo](https://demo.mobiscroll.com/angular/forms/radio-button)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-angular/tree/main/src/demos/form-components/forms/radio-button)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/javascript/forms/radio-button.md), [jQuery](https://demo.mobiscroll.com/jquery/forms/radio-button.md), [React](https://demo.mobiscroll.com/react/forms/radio-button.md), [Vue](https://demo.mobiscroll.com/vue/forms/radio-button.md)

## Description

Set up radio-button lists for mutually exclusive value selection. Different color presets are available.

## What this demo shows

- This demo shows different examples for radio buttons.
- **Single selection** Radio button groups for selecting one option from a set of mutually exclusive choices.
- **Option content** Radio buttons with labels and optional descriptive text.
- **States** Selected, unselected, and disabled radio button states.
- **Color presets** Primary, secondary, success, danger, warning, and info radio button colors.
- **Selection indicator** A checkmark identifies the currently selected option.

## Best for

- **Settings and preferences** Choosing one value from a small set of configuration options.
- **Forms and questionnaires** Presenting mutually exclusive answers that remain visible for quick comparison.
- **Plans and service levels** Selecting one option when labels and supporting descriptions help explain the differences.
- **Availability constraints** Showing choices that are currently unavailable with a disabled state.
- **Status-based choices** Using color presets to distinguish options with different meanings or levels of importance.

## Tutorial

```html
<mbsc-radio-group [(ngModel)]="group">
    <mbsc-radio label="Radio Option 1" description="This is description for radio 1" value="opt1"></mbsc-radio>
    <mbsc-radio label="Radio Option 2" description="This is description for radio 2" value="opt2"></mbsc-radio>
    <mbsc-radio label="Radio Option 3" value="opt3"></mbsc-radio>
    <mbsc-radio label="Disabled" [disabled]="true" value="opt4"></mbsc-radio>
</mbsc-radio-group>
```

```html
<mbsc-radio-group [(ngModel)]="colors">
    <mbsc-radio label="Primary" color="primary" value="primary"></mbsc-radio>
    <mbsc-radio label="Secondary" color="secondary" value="secondary"></mbsc-radio>
    <mbsc-radio label="Success" color="success" value="success"></mbsc-radio>
    <mbsc-radio label="Danger" color="danger" value="danger"></mbsc-radio>
    <mbsc-radio label="Warning" color="warning" value="warning"></mbsc-radio>
    <mbsc-radio label="Info" color="info" value="info"></mbsc-radio>
</mbsc-radio-group>
```

## Code

### Component

```ts
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MbscModule, setOptions } from '@mobiscroll/angular';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  standalone: true,
  imports: [CommonModule, FormsModule, MbscModule],
})
export class AppComponent {
  group = 'opt1';
  colors = 'success';
}
```

### Template

```html
<mbsc-page>
  <div class="mbsc-form-group">
    <div class="mbsc-form-group-title">Radio buttons</div>
    <mbsc-radio-group [(ngModel)]="group">
      <mbsc-radio label="Radio Option 1" description="This is description for radio 1" value="opt1"></mbsc-radio>
      <mbsc-radio label="Radio Option 2" description="This is description for radio 2" value="opt2"></mbsc-radio>
      <mbsc-radio label="Radio Option 3" value="opt3"></mbsc-radio>
      <mbsc-radio label="Disabled" [disabled]="true" value="opt4"></mbsc-radio>
    </mbsc-radio-group>
  </div>
  <div class="mbsc-form-group">
    <div class="mbsc-form-group-title">Radio button colors</div>
    <mbsc-radio-group [(ngModel)]="colors">
      <mbsc-radio label="Primary" color="primary" value="primary"></mbsc-radio>
      <mbsc-radio label="Secondary" color="secondary" value="secondary"></mbsc-radio>
      <mbsc-radio label="Success" color="success" value="success"></mbsc-radio>
      <mbsc-radio label="Danger" color="danger" value="danger"></mbsc-radio>
      <mbsc-radio label="Warning" color="warning" value="warning"></mbsc-radio>
      <mbsc-radio label="Info" color="info" value="info"></mbsc-radio>
    </mbsc-radio-group>
  </div>
</mbsc-page>
```

## Implementation notes

- Radios are grouped with `RadioGroup`/`mbsc-radio-group` (JS/jQuery: a `div` carrying the `mbsc-radio-group` attribute); an individual option is `Radio`/`mbsc-radio`/`input[mbsc-radio][type="radio"]`.
- Mutual exclusivity within a group comes from a shared `name`: set on the group in React/Vue (`RadioGroup name="group"`), or on each input in JS/jQuery and Angular.
- `label` sets an option's primary text; `description` (`data-description` in JS/jQuery) adds secondary explanatory text beneath the label.
- Selection state is bound differently per framework: Angular and Vue bind the selected value on the group itself (`[(ngModel)]="group"` in Angular, `v-model="radio"` in Vue) with each option supplying its own `value`; React marks the initially selected option with `defaultChecked={true}`; JS/jQuery marks it with the plain `checked` attribute on that option's input.
- `disabled` makes a single option non-selectable: React `disabled={true}`, Vue `:disabled="true"`, Angular `[disabled]="true"`, JS/jQuery the bare `disabled` attribute.
- `color` (`data-color` in JS/jQuery) sets a preset color per option: `primary`, `secondary`, `success`, `danger`, `warning`, `info`.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-angular.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config angular
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   ng serve
   ```

On a trial, add `--trial` to the config command: `mobiscroll config angular --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/angular/getting-started/installation

## Related demos

- Previous: [Switch](https://demo.mobiscroll.com/angular/forms/switch.md) - Angular switch/toggle demo with or without description. Alternative to the checkbox. Supports disabled styling.
