logo
为了能更好地了解您的商业使用需求,请参与 Ant Design Blazor 商业应用调查,一起建设商业应用社区,为企业系统研发赋能!

Radio单选框

Examples

最简单的用法。

expand code expand code

一组互斥的 Radio 配合使用。

expand code expand code

大中小三种组合,可以和表单输入框进行对应配合。

expand code expand code

可以为 Radio.Group 配置 name 参数,为组合内的 input 元素赋予相同的 name 属性,使浏览器把 Radio.Group 下的 Radio 真正看作是一组(例如可以通过方向键始终在同一组内更改选项)。

expand code expand code

通过配置 options 参数来渲染单选框。

expand code expand code

泛型的用法。

expand code expand code

Radio 不可用.

expand code expand code

垂直的 Radio.Group,配合更多输入框选项。

expand code expand code

按钮样式的单选组合。

expand code expand code

实色填底的单选按钮样式。

expand code expand code

通过指定枚举类型,来渲染单选框。

expand code expand code

Radio API#

属性 描述 类型 默认值
ChildContent 属性显示 Radio 的标签内容 RenderFragment --
Value 属性选定值 TValue --
AutoFocus 属性是否自动对焦 Boolean false
RadioButton 属性设置为 true 将 Radio 设置为按钮组。 Boolean false
Checked 属性指定 Radio 是否被选中 Boolean --
DefaultChecked 属性指定是否最初选中 Radio Boolean false
CheckedChanged 属性checked 状态改变时执行的回调 EventCallback<Boolean> --
Disabled 属性禁用 Radio Boolean --
CheckedChange 属性checked 状态改变时执行的回调请改用 CheckedChanged

Obsolete 将在未来的版本中删除。
EventCallback<Boolean> --
Id 属性组件 HTML 的 ID String Uniquely Generated ID
Class 属性为 DOM 元素指定一个或多个类名。 String --
Style 属性指定 DOM 元素的内联样式。 String --
RefBack 属性一个 ForwardRef 实例。您可以使用 AntDesign.ForwardRef.Current 获取对内部 DOM 的引用。 ForwardRef --

RadioGroup API#

属性 描述 类型 默认值
ChildContent 属性该组的单选元素。使用这个或 AntDesign.RadioGroup`1.Options RenderFragment --
Disabled 属性该组是否被禁用 Boolean --
ButtonStyle 属性组的按钮样式。 RadioButtonStyle? RadioButtonStyle.Outline
Name 属性输入组中所有 Radio 的名称 String --
DefaultValue 属性组的默认选择值 TValue --
OnChange 属性选中值改变时执行的回调 EventCallback<TValue> --
Options 属性在组中显示 Radio 的选项。使用这个或 AntDesign.RadioGroup`1.ChildContent OneOf<String[], RadioOption`1[]> --
ValidationMessages FormItem 的验证消息 String[] --
AdditionalAttributes 属性获取或设置将应用于所创建元素的附加属性的集合。 IReadOnlyDictionary<String, Object> --
Value 属性获取或设置输入的值。这应该与双向绑定一起使用。 TValue --
ValueChanged 属性更新绑定值的回调。 EventCallback<TValue> --
ValueExpression 属性标识绑定值的表达式。 Expression<Func<TValue>> --
ValuesExpression 属性标识可枚举绑定值的表达式。 Expression<Func<IEnumerable<TValue>>> --
Size 属性输入框的大小。注意:在表单的上下文中,使用“大”尺寸。可用:`大``默认``小` String AntSizeLDSType.Default
CultureInfo 属性将字符串转换为值和将值转换为字符串时将使用什么文化对 InputNumber 组件有用。 CultureInfo CultureInfo.CurrentCulture
Id 属性组件 HTML 的 ID String Uniquely Generated ID
Class 属性为 DOM 元素指定一个或多个类名。 String --
Style 属性指定 DOM 元素的内联样式。 String --
RefBack 属性一个 ForwardRef 实例。您可以使用 AntDesign.ForwardRef.Current 获取对内部 DOM 的引用。 ForwardRef --
Mentions提及 Rate评分
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.