Radio

Used to select a single state from multiple options.
Import

When To Use#

  • Used to select a single state in multiple options.
  • The difference from Select is that Radio is visible to the user and can facilitate the comparison of choice, which means there shouldn't be too many of them.

Examples

The simplest use.

      Loading...
    

A group of nz-radio components.

      Loading...
    

Render radios by configuring options.

      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.

      Loading...
    

Solid radio button style.

      Loading...
    



nz-radio unavailable.

      Loading...
    

Vertical nz-radio-group, with more radios.

      Loading...
    




The combination of radio button style.

      Loading...
    




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

      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