组件

Asterisk

Hand-drawn footnote marks: an asterisk, a star, a dagger or a double dagger, in red pencil, sized like a superscript after the word they belong to. Give it a label and an href and it links to the footnote.

安装

terminal
npx shadcn@latest add @wobko/asterisk

第一次使用?先把 registry 加进 components.json。 如何安装

示例

Default

A red-pencil asterisk after a word, raised like a superscript.

Marks and pens

Asterisk, star, dagger and double dagger; red, ink, blue and pencil. Text inside comes first and the mark follows it.

A price with a footnote

The mark is a link (with a name) to the footnote at the foot of the card, sized to the 36 px price it follows.

API 参考

Asterisk

A <span> holding the drawn mark. Children come first and the mark follows them: <Asterisk>fine print</Asterisk>. The glyph is intrinsic art (kept in Windows high contrast) drawn once per seed.

属性类型默认值说明
mark"asterisk" | "star" | "dagger" | "double-dagger""asterisk"Which mark.
tone"red" | "ink" | "blue" | "pencil""red"The pen color of the mark.
labelstring-The accessible name ("footnote 1"). Without it the mark is decoration and hidden from assistive technology.
hrefstring-Turns the mark into a link to the footnote. Its accessible name is `label`, or "footnote".
seedstring | number-Pins the hand of the strokes.

无障碍

  • Decorative by default (aria-hidden). With `label` it is role="img" with that name; with `label` and `href` it is a real link (its hit area is 24 px or more).
  • A footnote mark points at a footnote: keep the footnote in text, and link the two (`href="#fn1"` here and an id on the note).
  • Sized in em, so it follows the text it sits in. Kept in Windows high contrast as a drawn glyph.

源码

CLI 会复制进你项目的文件。

正在加载源码