SxRadioGroup (单选框组)
单选按钮容器。对齐 Microsoft Fluent UI Blazor RadioGroup (v4.13.2) 的 API 结构,并说明 NextUI 当前实现状态。
使用场景
约束说明
- 与
SxRadio 搭配使用。
Value 为泛型类型。
行为说明
Orientation 控制排列方向。
ReadOnly 为真时不触发变更。
API
Parameters (参数)
| 状态 |
参数名 |
类型 |
默认值 |
描述 |
| Implemented |
Value |
TValue? |
default |
当前选中值。 |
| Implemented |
Label |
string? |
null |
组标题。 |
| Implemented |
Orientation |
Orientation |
Horizontal |
排列方向。 |
| Implemented |
Name |
string? |
Guid |
组 name。 |
| Implemented |
ReadOnly |
bool |
false |
只读状态。 |
| Implemented |
Required |
bool |
false |
必填状态。 |
| Implemented |
AriaLabel |
string? |
null |
辅助标签。 |
| Implemented |
AccessKey |
string? |
null |
快捷键。 |
| Implemented |
TabIndex |
int? |
null |
Tab 顺序。 |
| Implemented |
Disabled (继承) |
bool |
false |
禁用状态。 |
| Implemented |
Id (继承) |
string? |
null |
组件 Id。 |
| Implemented |
Class (继承) |
string? |
null |
CSS 类名。 |
| Implemented |
Style (继承) |
string? |
null |
自定义样式。 |
| Implemented |
Title (继承) |
string? |
null |
HTML title。 |
| Implemented |
AdditionalAttributes (继承) |
IEnumerable<KeyValuePair<string, object>>? |
null |
额外属性。 |
Events (事件)
| 状态 |
事件名 |
类型 |
描述 |
| Implemented |
ValueChanged |
EventCallback<TValue?> |
选中项改变时触发。 |
示例
<SxRadioGroup TValue="string" @bind-Value="_value">
<SxRadio Value="a" Label="A" />
<SxRadio Value="b" Label="B" />
</SxRadioGroup>
参考设计 (References)