SxLabel (标签)
- Implemented
简单的文本标签组件。对齐 Microsoft Fluent UI Blazor Label (v4.13.2) 的 API 结构,并说明 NextUI 当前实现状态。
使用场景
- 表单字段标题
- 组合控件标题
- 说明性文本标签
约束说明
Text为必填显示内容。For用于关联表单元素 Id。
行为说明
Required为真时显示必填标识。Position控制标签布局方向。
API
Parameters (参数)
| 状态 | 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|---|
| Implemented | Text |
string |
"" |
标签文本。 |
| Implemented | Icon |
string? |
null |
标签图标。 |
| Implemented | Required |
bool |
false |
是否显示必填星号。 |
| Implemented | Position |
LabelPosition |
Top |
标签位置。 |
| Implemented | Weight |
FontWeight |
Normal |
字体粗细。 |
| Implemented | ChildContent |
RenderFragment? |
null |
关联内容区域。 |
| Implemented | For |
string? |
null |
关联的表单元素 ID。 |
| 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 |
捕获不匹配的 HTML 属性。 |
示例
<SxLabel Text="用户名" For="username" Required="true" />