An envelope
Press it, or Tab to it and press Space: the flap stands up behind and the letter slides out. Hover lifts the flap a sliver.
An envelope on the desk with a stamp, a postmark and address lines. It opens: the flap, which belongs to the back panel, stands up behind, and a letter slides out from between the panels, the front panel hiding its foot. Built on Collapsible, so it has a real trigger, `aria-expanded`, and content that is not in the page until it is out.
npx shadcn@latest add @wobko/envelope第一次使用?先把 registry 加进 components.json。 如何安装
Press it, or Tab to it and press Space: the flap stands up behind and the letter slides out. Hover lifts the flap a sliver.
Kraft (the default), white paper with a sky-blue stamp, and an airmail envelope with its striped border. Each stamp is perforated; each has a postmark over it.
`openOnHover` opens it under a mouse and closes it again on leaving, unless you clicked it open. On touch and keyboard the trigger works as always.
A real use: messages that arrive as envelopes. Opening one marks it read; only one is open at a time. State lives in your app; the envelope only shows it.
The outer element (`w-full max-w-sm`, a container for its own measurements) around the body (`aspect-[8/5]`), whose drawing is the back panel: a sheet with the flap that lifts a sliver on hover and stands up when open. When open the envelope makes room above itself for the flap and the letter.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| stock | StockName | "kraft" | What it is made of: kraft (manila), paper, index-card, a sticky stock ... |
| stamp | Accent | false | "tomato" | The postage stamp in the top corner (perforated, with a little picture), in a stationery color, or none. It sits at the end corner and mirrors in RTL. |
| postmark | boolean | true | Two rings and wavy cancellation lines over the stamp (only with a stamp). |
| airmail | boolean | false | A border of slanted red and blue stripes. |
| open / defaultOpen / onOpenChange | boolean / boolean / (open: boolean) => void | - | As Collapsible: controlled or not. |
| disabled | boolean | false | Sealed: the trigger is disabled (as Collapsible's `disabled`) and hovering opens nothing. |
| openOnHover | boolean | false | Also open while a mouse is over it and close when it leaves (unless it was opened by a click). Touch never opens it on hover. |
| tilt / seed / size | boolean | number / string | number / [w, h] | - | A seeded turn under 1.1 degrees (front and back turn together); pins the hand; the box in px for server-rendered drawings. |
The letter: a Paper (paper stock by default) absolutely placed between the panels. It is not in the page while the envelope is closed; when it opens it slides up (and fades in), rising about a third of the envelope's height above its top edge. Only that upper part shows; the front panel hides the rest.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| stock | StockName | "paper" | The letter's paper. |
CLI 会复制进你项目的文件。
正在加载源码