Skip to content
VenusUI
Get started

Envelope

A sealed envelope that opens on hover or click: the flap folds back and the letter slides out.

Preview

Installation

npx shadcn@latest add @venusui/envelope

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/envelope.tsx

Usage

The 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 &amp; 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>
  )
}

API reference

PropTypeDefaultDescription
childrenReactNode—The letter. Any content, including links and buttons.
labelstring—Names the envelope for screen readers, e.g. “Invitation from Maya”.
tostring—Shown on the front, e.g. the recipient's name.
colorstringoklch(0.93 0.035 75)Envelope color: any CSS color; the flap and pocket shades are mixed from it.
open, defaultOpenboolean—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).

Requirements

  • React 19 and Tailwind CSS v4.

Customization

  • Leave room above it: the letter rises out of the envelope by about 60% of its height. The component adds top padding for this.
  • Keep the letter short (it shows about two-thirds of the envelope's height); link to a full page for details.

Accessibility

  • A button with aria-expanded covers the envelope; Enter or Space opens it, so it works without a mouse.
  • The letter is inert while closed, so its links can't be reached until it's out.
  • With reduced motion it opens without animation.

Troubleshooting

The letter is cut off at the top.
A parent has overflow-hidden, or the envelope's top padding was removed. Keep the space above it.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (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 found
Run npx shadcn@latest init in your project first.
Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

Stacked cards with the next ones peeking out; Next sends the top card to the back.

Loading preview

A two-sided card that turns over in 3D, by button or on hover.