Card

Credit Card

Presentational payment card drawn in SVG with dark, black and glass finishes, a 3D flip to the back and a button that reveals the masked number and CVV. Client component with translatable labels.

The source comes with full access.

One payment of $149 ($49 for now) opens the source right here and lets the CLI install every paid component, with lifetime updates.

Installation

pnpm dlx shadcn add @01orbital/credit-card
npx shadcn add @01orbital/credit-card
yarn shadcn add @01orbital/credit-card
bunx --bun shadcn add @01orbital/credit-card

Part of the 01orbital library. With a license, put ORBITAL_TOKEN in .env.local and the same command installs it (licensed install, pricing).

It lands at components/card/credit-card.tsx, as source you own and edit.

The example also uses toggle-group. Install it too:

pnpm dlx shadcn add @01orbital/toggle-group
npx shadcn add @01orbital/toggle-group
yarn shadcn add @01orbital/toggle-group
bunx --bun shadcn add @01orbital/toggle-group

Usage

"use client"

import { useState } from "react"

import { CreditCard } from "@/components/card/credit-card"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

// Every word on the page. Change copy here, not in the markup.
const FINISHES = [
  { value: "dark", label: "Slate" },
  { value: "black", label: "Ink" },
  { value: "glass", label: "Glass" },
] as const

export default function CreditCardDemo() {
  const [variant, setVariant] = useState<"dark" | "black" | "glass">("dark")
  return (
    <>
      <ToggleGroup
        aria-label="Card finish"
        value={[variant]}
        onValueChange={(values) => {
          const value = values[0]
          if (value === "dark" || value === "black" || value === "glass")
            setVariant(value)
        }}
      >
        {FINISHES.map(({ value, label }) => (
          <ToggleGroupItem key={value} value={value}>
            {label}
          </ToggleGroupItem>
        ))}
      </ToggleGroup>
      <CreditCard className="p-4" variant={variant} />
    </>
  )
}

API reference

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: class-variance-authority, cn. The CLI installs them for you.

Registry pieces it installs with it:

  • button