组件

Signature

A name signed in the script font with the pen's flourish under it: a swoosh with a loop that flicks up past the last letter. The name is ordinary text; the flourish is a drawing that can write itself on.

安装

terminal
npx shadcn@latest add @wobko/signature

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

示例

Default

A name and its pen tail.

Flourishes, sizes and pens

A swoosh, an underline, none; three sizes; blue, ink and red pens. A signature keeps its own size in a row or a grid, so names of different sizes sit on one baseline with `self-baseline`.

The end of a letter

Sign it: the name is written left to right, then the flourish follows the pen.

API 参考

Signature

An inline-block <span> holding the name (in `data-slot="signature-name"`) and the aria-hidden flourish. Size the name with `size` or any text class.

属性类型默认值说明
flourish"swoosh" | "underline" | "none""swoosh"The pen's tail: a swoosh with a loop and a crossing stroke, a flourished underline, or nothing.
size"sm" | "md" | "lg""md"The name at 28, 44 or 64 px. Override with a text-* class.
tone"blue" | "ink" | "red" | "green" | "pencil" | "marker" | "orange""blue"The pen of the flourish (and the color of the name for blue and ink).
weight"fine" | "regular" | "brush""regular"Fine-liner, felt tip or brush.
animatebooleanfalseSign it in the first time it scrolls into view: the name is written left to right, then the flourish.
showbooleantrueShow or hide the flourish (the name always stays).
delaynumber-Milliseconds before signing starts.
seedstring | number-Pins the hand.

无障碍

  • The name is real text in the page, read by a screen reader; the flourish is aria-hidden. A signature is not proof of anything: say who signed in text if it matters.
  • The name text is not clipped by the flourish; the drawing spills 20 px beyond its box and never takes a click.
  • Reduced motion zeroes the signing animation.

源码

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

正在加载源码