IN-12InputsNew, October 22, 2026
Card Field
A one-row card input for checkout. The number groups the way the brand prints it, then slides to its last four to make room for expiry and CVC.
PRONeed the button that charges it? Pay Button is in Kokonut UI Pro
Installation
Card Field is a free, open-source React component in the Kokonut UI Inputs collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/card-field.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/card-fieldOr add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/card-field.tsx.
npm install lucide-react motionUsage
import CardField from "@/components/kokonutui/card-field";
export default function Example() {
return <CardField />;
}Props
amountnumberDefault 48What the button charges.
currencystringDefault "$"onPay(card: CardDetails) => Promise<void> | voidCharge the card. Return a promise and the button waits for it.
testModebooleanDefault trueShows a "Use test card" link that types 4242… in for you.
classNamestringExtra classes for the root element.
CardDetails
brandrequiredBrandlast4requiredstringexpiryrequiredstringMM/YY
Brand
type Brand = "visa" | "mastercard" | "amex" | "discover" | "unknown";Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react | ^0.556.0 | npm, installed by the CLI |
motion | ^12.23.25 | npm, installed by the CLI |
cn from lib/utils.ts | shadcn init | |
| React | 19 | Your app |
| Tailwind CSS | 4 | Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.

