logo

Radio

Radio

When To Use

-Used to select a single state from 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.

expand code expand code

A group of radio components.

expand code expand code

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

expand code expand code

Passing the name property to all input[type="radio"] that are in the same Radio.Group. It is usually used to let the browser see your 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 Radio.Group.

expand code expand code

Render radios by configuring options.

expand code expand code

The generic use.

expand code expand code

Radio unavailable.

expand code expand code

Vertical Radio.Group, with more radios.

expand code expand code

The combination of radio button style.

expand code expand code

Solid radio button style.

expand code expand code

Render radios by specific enum type.

expand code expand code

Radio API#

Property Description Type Default Value
ChildContent ParameterDisplay label content for the radio RenderFragment --
Value ParameterSelected value TValue --
AutoFocus ParameterAutofocus or not Boolean false
RadioButton ParameterSet to true to style the radio as button group. Boolean false
Checked ParameterSpecifies whether the radio is selected Boolean --
DefaultChecked ParameterSpecify if the radio button is checked initially or not Boolean false
CheckedChanged ParameterCallback executed when the checked state changes EventCallback<Boolean> --
Disabled ParameterDisable the radio buton Boolean --
CheckedChange ParameterCallback executed when the checked state changesUse CheckedChanged instead

Obsolete Will be removed in a future version.
EventCallback<Boolean> --
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --

RadioGroup API#

Property Description Type Default Value
ChildContent ParameterRadio elements for the group. Use either this or AntDesign.RadioGroup`1.Options RenderFragment --
Disabled ParameterIf the group is disabled or not Boolean --
ButtonStyle ParameterButton style for the group. RadioButtonStyle? RadioButtonStyle.Outline
Name ParameterInput name for all the radios in the group String --
DefaultValue ParameterThe default selected value for the group TValue --
OnChange ParameterCallback executed when the selected value changes EventCallback<TValue> --
Options ParameterOptions to display a radio for in the group. Use either this or AntDesign.RadioGroup`1.ChildContent OneOf<String[], RadioOption`1[]> --
ValidationMessages Validation messages for the FormItem String[] --
AdditionalAttributes ParameterGets or sets a collection of additional attributes that will be applied to the created element. IReadOnlyDictionary<String, Object> --
Value ParameterGets or sets the value of the input. This should be used with two-way binding. TValue --
ValueChanged ParameterCallback that updates the bound value. EventCallback<TValue> --
ValueExpression ParameterAn expression that identifies the bound value. Expression<Func<TValue>> --
ValuesExpression ParameterAn expression that identifies the enumerable of bound values. Expression<Func<IEnumerable<TValue>>> --
Size ParameterThe size of the input box. Note: in the context of a form, the `large` size is used. Available: `large` `default` `small` String AntSizeLDSType.Default
CultureInfo ParameterWhat Culture will be used when converting string to value and value to string Useful for InputNumber component. CultureInfo CultureInfo.CurrentCulture
Id ParameterID for the component's HTML String Uniquely Generated ID
Class ParameterSpecifies one or more class names for an DOM element. String --
Style ParameterSpecifies an inline style for a DOM element. String --
RefBack ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. ForwardRef --
Mentions Rate
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.