引文
@astryxdesign/core v0.7.1 · Citation
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
source | CitationSource | - | title 是可见标题,空着就回退到编号。url 会渲染成链接。src 是站点图标。icon 是图片地址或 CSS 图标类,优先于 src。 |
number | number | - | 从 1 开始的序号。会读进无障碍名称,数字变体也会显示它。 |
variant | 'label' | 'number' | 'label' | label 是带标题的胶囊。number 是紧凑的上标。 |
模板引用暴露 element,也就是那个链接或 span。
主题
packages/themes/neutral/citation.css 把组件变量映射到语义 token。换主题时覆盖这些变量即可。
--astryx-citation-foreground/--astryx-citation-foreground-hover:默认和悬停时的文字颜色。--astryx-citation-border/--astryx-citation-hover:胶囊边框和悬停底色。--astryx-citation-number-background:上标底色。--astryx-citation-icon-background:label 图标后面的圆。--astryx-citation-focus:键盘焦点描边。--astryx-duration-fast-max/--astryx-ease-standard:悬停过渡。
原生属性
属性落到根节点上。有 source.url 时根节点是 <a>,否则是 <span>。target、rel、role、aria-label 和 title 由组件自己设置。