Skip to content
VenusUI
Get started

Gift Box

A wrapped gift that pops its lid with confetti and reveals a coupon code with a copy button.

Preview

Installation

npx shadcn@latest add @venusui/gift-box

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/gift-box.tsx

Usage

The code behind the preview above.

gift-box-demo.tsx

import { GiftBox } from "@/components/ui/gift-box"

export default function GiftBoxDemo() {
  return <GiftBox code="THANKS15" reward="15% off your next order" />
}

API reference

PropTypeDefaultDescription
codestring—The coupon code revealed inside.
rewardstring—What it gets you, e.g. “15% off your next order”.
colorstringoklch(0.62 0.2 15)Box color: any CSS color; the lid is a shade darker and the ribbon stays gold.
onOpen() => void—Called when the gift is opened.

All <div> props.

Requirements

  • lucide-react for the copy icon. React 19 and Tailwind CSS v4. The CLI adds the gift-box-confetti keyframes.

Customization

  • Leave room above it: the card rises out of the box. The component adds top padding for this.

Accessibility

  • The box is a button (“Open the gift”); the copy button is labelled with the code and announces “Code copied”.
  • With reduced motion there's no confetti and the lid moves without animation.

Troubleshooting

Copy doesn't work.
Browsers allow clipboard access only on secure (https) pages; the code stays visible to copy by hand.
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

Camera Shutter

Interactive

A lens with a working iris: blades close to the chosen aperture and snap shut when you release the shutter.

Loading preview

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