SxAnchor (超链接)
用于导航的超链接组件,支持图标与多种视觉风格。对齐 Microsoft Fluent UI Blazor Anchor (v4.13.2) 的 API 结构,并说明 NextUI 当前实现状态。
使用场景
- 文本或图标链接跳转
- 与按钮风格一致的轻量导航
- 列表中的外链操作
约束说明
Disabled / Loading 为 true 时不触发 OnClick。
IconStart / IconEnd 使用图标名称字符串。
行为说明
StopPropagation 控制是否阻止点击冒泡。
- 禁用状态会设置
aria-disabled="true"。
- 在
SxAppShell 内部导航模式下,SxAnchor 会优先触发内部导航(不切换全局路由)。
API
Parameters
| 状态 |
参数名 |
类型 |
默认值 |
描述 |
| Implemented |
Href |
string? |
null |
链接地址。 |
| Implemented |
Target |
string? |
null |
目标窗口。 |
| Implemented |
Appearance |
ButtonAppearance |
Neutral |
视觉风格。 |
| Implemented |
IconStart |
string? |
null |
前置图标。 |
| Implemented |
IconEnd |
string? |
null |
后置图标。 |
| Implemented |
IconStyle |
IconStyle |
Regular |
图标风格。 |
| Implemented |
Download |
string? |
null |
下载提示。 |
| Implemented |
Hreflang |
string? |
null |
资源语言。 |
| Implemented |
Ping |
string? |
null |
链接跟踪 URL。 |
| Implemented |
ReferrerPolicy |
string? |
null |
Referrer 策略。 |
| Implemented |
Rel |
string? |
null |
关系描述。 |
| Implemented |
Type |
string? |
null |
媒体类型提示。 |
| Implemented |
AriaLabel |
string? |
null |
无障碍标签。 |
| Implemented |
StopPropagation |
bool |
false |
阻止冒泡。 |
| Implemented |
TabKey |
string? |
null |
Tab 标识(用于内部导航分组)。 |
| Implemented |
NavigationTarget |
SxNavMenuNavigationTarget |
Auto |
导航目标(内部 / 外部 / 新标签)。 |
| Implemented |
ChildContent |
RenderFragment? |
null |
链接内容。 |
| Implemented |
Disabled (继承) |
bool |
false |
禁用状态。 |
| Implemented |
Loading (继承) |
bool |
false |
加载状态。 |
| Implemented |
Id (继承) |
string? |
null |
组件 Id。 |
| Implemented |
Class (继承) |
string? |
null |
自定义 CSS 类名。 |
| Implemented |
Style (继承) |
string? |
null |
自定义样式。 |
| Implemented |
Title (继承) |
string? |
null |
HTML title 属性。 |
| Implemented |
TabIndex (继承) |
int? |
null |
Tab 顺序。 |
| Implemented |
AccessKey (继承) |
string? |
null |
快捷键。 |
| Implemented |
AdditionalAttributes (继承) |
IEnumerable<KeyValuePair<string, object>>? |
null |
捕获不匹配的 HTML 属性。 |
Events
| 状态 |
事件名 |
类型 |
描述 |
| Implemented |
OnClick |
EventCallback<MouseEventArgs> |
点击触发。 |
示例
<SxAnchor Href="https://www.fluentui-blazor.net"
Target="_blank"
Appearance="ButtonAppearance.Accent"
IconStart="link">
访问官网
</SxAnchor>
参考设计 (References)