链接控件
在保留原生行为的同时为链接、具名图标控件和键盘快捷键提供样式。
用法
导航使用 ButtonLink,操作使用 IconButton,图标链接目标使用 IconLink 或 PlatformLink。由使用方提供 href 和本地化标签。
无障碍
为纯图标控件提供可访问名称,隐藏装饰图标,快捷键使用 Kbd。平台悬停效果遵循减少动态效果设置。
| 属性 | 类型 | 默认值 |
|---|---|---|
| href (links) | string | Required |
| aria-label / aria-labelledby (icon controls) | string | Required |
| platform | github | npm | Required |
| variant | primary | secondary | ghost | Native defaults |
| size | sm | md | md |
<>
<ButtonLink href="#/link-controls">Read guide</ButtonLink>
<IconButton aria-label="Open search example"><span aria-hidden="true">⌕</span></IconButton>
<IconLink href="#/link-controls" aria-label="Open reference example"><span aria-hidden="true">↗</span></IconLink>
<PlatformLinks role="group" aria-label="Platform links">
<PlatformLink platform="github" href="#/link-controls" aria-label="GitHub example" />
<PlatformLink platform="npm" href="#/link-controls" aria-label="npm example" />
</PlatformLinks>
<Kbd>Ctrl K</Kbd>
</>