Loading preview
Animated Card
CardsA card that tilts in 3D toward the pointer with spring physics.
A sealed envelope that opens on hover or click: the flap folds back and the letter slides out.
npx shadcn@latest add @venusui/envelopeRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/envelope.tsxThe code behind the preview above.
envelope-demo.tsx
import { Envelope } from "@/components/ui/envelope"
export default function EnvelopeDemo() {
return (
<Envelope label="Invitation from Maya and Theo" to="For Priya" className="w-[min(22rem,calc(100vw-3rem))]">
<p className="text-[10px] font-semibold tracking-[0.2em] text-rose-700 uppercase">You’re invited</p>
<p className="mt-2 font-serif text-xl leading-tight">Maya & Theo are getting married</p>
<p className="mt-2 text-xs leading-5 text-neutral-600">
Saturday 12 September, 4 pm, at the old boathouse by the lake. Dinner and dancing after.
</p>
<a href="#" className="mt-3 inline-block text-xs font-semibold text-rose-700 underline underline-offset-4">
RSVP by 1 August
</a>
</Envelope>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The letter. Any content, including links and buttons. |
| label | string | — | Names the envelope for screen readers, e.g. “Invitation from Maya”. |
| to | string | — | Shown on the front, e.g. the recipient's name. |
| color | string | oklch(0.93 0.035 75) | Envelope color: any CSS color; the flap and pocket shades are mixed from it. |
| open, defaultOpen | boolean | — | Controlled or initial open state. Unset, it opens on hover and toggles on click. |
| onOpenChange | (open: boolean) => void | — | Called when a click, tap or key press opens or closes it. |
All <div> props except children (which is the letter).
aria-expanded covers the envelope; Enter or Space opens it, so it works without a mouse.inert while closed, so its links can't be reached until it's out.overflow-hidden, or the envelope's top padding was removed. Keep the space above it.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.A card that tilts in 3D toward the pointer with spring physics.
Stacked cards with the next ones peeking out; Next sends the top card to the back.
A two-sided card that turns over in 3D, by button or on hover.