Radio

Radio.

When To Use#

  • Used to select a single state in multiple options.
  • The difference between Select is that Radio is visible to user and can facilitate the comparison of choice. So, when you want to use Radio, option should not be too much.
import { NzRadioModule } from 'ng-zorro-antd/radio';

Examples

The simplest use.

expand codeexpand code
Loading...

A group of nz-radio components.

expand codeexpand code
Loading...

Render radios by configuring options.

expand codeexpand code
Loading...

Passing the nzName property to all input[type="radio"] that are in the same RadioGroup. It is usually used to let the browser see your nz-radio-group as a real "group" and keep the default behavior. For example, using left/right keyboard arrow to change your selection that in the same nz-radio-group.

expand codeexpand code
Loading...

Solid radio button style.

expand codeexpand code
Loading...



nz-radio unavailable.

expand codeexpand code
Loading...

Vertical nz-radio-group, with more radios.

expand codeexpand code
Loading...




The combination of radio button style.

expand codeexpand code
Loading...




There are three sizes available: large, medium, and small. It can coordinate with input box.

expand codeexpand code
Loading...

API#

[nz-radio] | [nz-radio-button]#

PropertyDescriptionTypeDefault
[nzAutoFocus]get focus when component mountedbooleanfalse
[nzDisabled]Disable radiobooleanfalse
[ngModel]Specifies whether the radio is selected, double bindingbooleanfalse
[nzValue]use with nz-radio-groupany-
(ngModelChange)The callback function that is triggered when the state changes.EventEmitter<boolean>-

nz-radio-group#

radio group,wrap a group of nz-radio

PropertyDescriptionTypeDefault
[ngModel]current selected nz-radio value, double bindingany-
[nzName]The name property of all input[type="radio"] childrenstring-
[nzDisabled]Disable all radio buttonsbooleanfalse
[nzSize]Size, only on radio style'large' | 'small' | 'default''default'
(ngModelChange)the callback function when current selected nz-radio value changeEventEmitter<string>-
[nzButtonStyle]style type of radio button'outline' | 'solid''outline'

Methods#

[nz-radio]#

you can get NzRadioComponent via ViewChild

NameDescription
blur()remove focus
focus()get focus