Credit Card Dialog
revola/credit-cardFreeComponent
A responsive credit card form dialog with payment input validation - drawer on mobile, modal on desktop.
Install it
npx shadcn@latest add https://revola.sameerjs.com/r/credit-card.jsonSource
1"use client";23import { useId } from "react";4import { usePaymentInputs } from "react-payment-inputs";5import images, { type CardImages } from "react-payment-inputs/images";67import { CreditCardIcon, WalletIcon } from "lucide-react";89import { Button } from "@/components/ui/button";10import { Checkbox } from "@/components/ui/checkbox";11import { Input } from "@/components/ui/input";12import { Label } from "@/components/ui/label";13import {14 ResponsiveDialog,15 ResponsiveDialogContent,16 ResponsiveDialogDescription,17 ResponsiveDialogFooter,18 ResponsiveDialogHeader,19 ResponsiveDialogTitle,20 ResponsiveDialogTrigger,21} from "@/components/ui/revola";2223export default function CreditCardDialog() {24 const id = useId();25 const { meta, getCardNumberProps, getExpiryDateProps, getCVCProps, getCardImageProps } = usePaymentInputs();2627 return (28 <ResponsiveDialog>29 <ResponsiveDialogTrigger asChild>30 <Button variant="outline" className="h-12 rounded-full px-6 capitalize">31 Update Card32 </Button>33 </ResponsiveDialogTrigger>34 <ResponsiveDialogContent className="sm:max-w-sm">35 <div className="space-y-4 overflow-y-auto p-6 max-sm:pt-4">36 <div className="flex flex-col gap-2">37 <div>38 <div className="flex size-11 shrink-0 items-center justify-center rounded-full border" aria-hidden="true">39 <WalletIcon className="opacity-80" size={16} />40 </div>41 </div>42 <ResponsiveDialogHeader className="text-left">43 <ResponsiveDialogTitle>Update your card</ResponsiveDialogTitle>44 <ResponsiveDialogDescription>Your new card will replace your current card.</ResponsiveDialogDescription>45 </ResponsiveDialogHeader>46 </div>4748 <form className="space-y-5">49 <div className="space-y-4">50 <div className="space-y-2">51 <Label htmlFor={`name-${id}`}>Name on card</Label>52 <Input53 required54 type="text"55 id={`name-${id}`}56 placeholder="John Doe"57 className="[&:-webkit-autofill]:shadow-[0_0_0_30px_theme(colors.input)_inset]"58 />59 </div>60 <div className="space-y-2">61 <Label htmlFor={`number-${id}`}>Card Number</Label>62 <div className="relative">63 <Input64 {...getCardNumberProps()}65// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from revola
All 24 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alert Dialogalert-dialog | revola | Components | Free | no deps | |
| Alert Dialog with Iconalert-dialog-with-icon | revola | Components | Free | 1 dep | |
| Change Plan Dialogchange-plan | revola | Components | Free | 1 dep | |
| Checkout Dialogcheckout | revola | Components | Free | 2 deps | |
| Custom Scrollbar Dialogcustom-scrollbar | revola | Components | Free | no deps | |
| Delete Project Dialogdelete-project | revola | Components | Free | 1 dep | |
| Edit Profile Dialogedit-profile | revola | Components | Free | 1 dep · 3 files | |
| Feedback Dialogfeedback | revola | Components | Free | no deps |
