组件

Tally

A count as tally marks, 1 to 99: bundles of four struck through by a fifth. The number is the accessible name, the box is exactly as big as the marks, and it is drawn on the server.

安装

terminal
npx shadcn@latest add @wobko/tally

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

示例

Default

Seven: one bundle struck through and two more. `size` takes sm, md, lg or a number of pixels. The number is what a screen reader hears.

Counts, sizes and pens

Add a mark and watch the bundles build. Sizes sm, md, lg; ink, blue, red and pencil pens.

A vote board

Tallies beside the words they count. Each has its own accessible name ("12 votes for tea").

API 参考

Tally

A <span role="img" aria-label="7"> whose box is the marks' own footprint, so it sits in a line of text or a table cell without shifting anything.

属性类型默认值说明
countnumber-The number to show, clamped to 0..99 and rounded down.
size"sm" | "md" | "lg" | number"md"Height of the strokes: sm 14 px, md 22, lg 34, or a number of px.
tone"ink" | "blue" | "red" | "green" | "pencil" | "marker" | "orange""ink"The pen.
weight"fine" | "regular" | "brush""regular"Fine-liner, felt tip or brush.
labelstring-The accessible name. Default: the number. Say what is counted: "7 votes".
animatebooleanfalseWipe the marks on, left to right, the first time they scroll into view.
showbooleantrueShow or hide them.
delaynumber-Milliseconds before the drawing starts.
seedstring | number-Pins the hand.

无障碍

  • role="img" with aria-label set to the number (or your label): a screen reader hears "7", not seven strokes. Add the counted thing in visible text nearby.
  • The marks are the only place the number is shown as a drawing, so the svg is kept in Windows high contrast (as system colors).
  • Right-to-left pages start the first bundle on the right.
  • Reduced motion zeroes the wipe.

源码

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

正在加载源码