组件

Ticket

A ticket with concave corners, a bite out of both edges where the stub tears off, and a row of holes along the tear. The holes are cut out of the paper, so the desk (and the shadow) show through. A body, a stub, spaced capitals in the typewriter font and a serial number in red.

安装

terminal
npx shadcn@latest add @wobko/ticket

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

示例

Admit one

Concave corners, a bite out of both edges where the stub tears off, and a row of holes along the tear. The whole silhouette is drawn, holes and all.

Stocks, stubs, used

Kraft, cream, cinema yellow and tram-ticket pink. The stub can be at the start, wider, or not there; a punched hole says it has been used.

Taped to the page

A ticket is an ordinary positioned box: tape and stamps go on it with plain className. Its shadow follows the notches and the holes.

Your tickets

A real list: tickets with an action, a status, and a punched hole once used. The state lives in your app; the ticket only shows it.

API 参考

Ticket

A flex row. Its whole silhouette is one drawn sheet, tilted and shadowed as one; the content on it is real DOM. Until it is measured (or given `size`) it wears a plain card.

属性类型默认值说明
stockStockName"kraft"What it is printed on: kraft, index-card (cream), sticky-yellow (a cinema ticket), sticky-pink ...
stub"end" | "start" | "none""end"Where the tear-off stub is. Mirrors in right-to-left layouts.
stubWidthnumber88Width of the stub in px; the tear line sits that far from the edge.
punchedbooleanfalseA hole punched through the body, at the end of the reading line beside the tear (the words start at the other side): the ticket has been used.
tilt / seed / sizeboolean | number / string | number / [w, h]-A seeded turn under 1.2 degrees (or degrees, or false); pins the hand; the box in px for server-rendered drawings.

无障碍

  • A ticket is a `div`. Give it `role="group"` and a label when several sit on a page. The stub is an `aside` with `role="note"`, so a page of tickets does not fill up with unnamed complementary landmarks.
  • The drawn paper, notches, holes and frames are aria-hidden decoration; the ticket's information is text in the body and stub. Punched is shown by a hole and a data attribute: also say it in text ("Used") if it matters.
  • Ink on every ticket stock is at least 9:1; the serial number is a red darkened with ink and reads at least 4.9:1 on kraft, yellow and pink. The tilt is zero in calm density; Windows high contrast replaces the drawing with an outline.

源码

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

正在加载源码