Skip to content
VenusUI
Get started

Credit Card Form

A card form with a live card that fills in as you type and turns over for the security code.

Preview

Installation

npx shadcn@latest add @venusui/credit-card-form

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/credit-card-form.tsx

Also adds the shadcn button, input components if your project doesn't have them yet.

Usage

The code behind the preview above.

credit-card-form-demo.tsx

import { CreditCardForm } from "@/components/ui/credit-card-form"

export default function CreditCardFormDemo() {
  return <CreditCardForm />
}

API reference

PropTypeDefaultDescription
submitLabelstring"Save card"Button text.
successMessagestring"Card details look valid."Shown after valid details are submitted.
onComplete(details: CardDetails) => void—Receives the validated details.

All <form> props except onSubmit.

Requirements

  • lucide-react for icons. shadcn button and input. The CLI installs them. React 19 and Tailwind CSS v4.

Customization

  • Pass onComplete details directly to your payment provider’s SDK. Never log them or store them on your own server.

Accessibility

  • Each field has a label, the right autocomplete value and an error tied to it. The card picture is decorative.

Troubleshooting

Something looks different from the preview.
Components use your project’s theme tokens, so surrounding colours and radius follow your styles.
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

A flight boarding pass with a perforated stub and code that flips to the fare and baggage details.

Loading preview

A light that travels around the border of a card or container.