# Add Card Form

> Add payment method form with name, card number, expiry, CVC, a country select, and a set-as-default switch.

A shadcn/ui block from the [@7ovr](https://7ovr.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/7ovr/billing-6).

- Page, with a live preview: https://shadcn.exchange/r/7ovr/billing-6
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/7ovr/billing-6-light-5ab42b356f5bab21.png
- Registry item: https://7ovr.com/r/billing-6.json
- Categories: billing
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://7ovr.com/r/billing-6.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `@base-ui/react`
- Registry items: `button`, `card`, `field`, `input`, `select`, `switch`

## Files

### `registry/blocks/billing/6/billing-block.tsx`

```tsx
import { Button } from "@/components/ui/button"
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"
import { Switch } from "@/components/ui/switch"
import { IconPlaceholder } from "@/components/icons/icon-placeholder"

export default function BillingBlock() {
  return (
    <section className="flex w-full items-center justify-center bg-background px-6 py-16 text-foreground">
      <Card className="w-full max-w-md">
        <CardHeader>
          <CardTitle>Add payment method</CardTitle>
          <CardDescription>
            Add a card to keep your subscription active.
          </CardDescription>
        </CardHeader>
        <CardContent>
          <form className="flex flex-col gap-5">
            <FieldGroup>
              <Field>
                <FieldLabel htmlFor="name">Name on card</FieldLabel>
                <Input id="name" placeholder="Ada Lovelace" />
              </Field>
              <Field>
                <FieldLabel htmlFor="number">Card number</FieldLabel>
                <Input id="number" placeholder="1234 1234 1234 1234" />
              </Field>
              <div className="grid grid-cols-2 gap-3">
                <Field>
                  <FieldLabel htmlFor="expiry">Expiry</FieldLabel>
                  <Input id="expiry" placeholder="MM/YY" />
                </Field>
                <Field>
                  <FieldLabel htmlFor="cvc">CVC</FieldLabel>
                  <Input id="cvc" placeholder="123" />
                </Field>
              </div>
              <Field>
                <FieldLabel htmlFor="country">Country</FieldLabel>
                <Select defaultValue="us">
                  <SelectTrigger id="country">
                    <SelectValue />
                  </SelectTrigger>
                  <SelectContent alignItemWithTrigger={false}>
                    <SelectItem value="us">United States</SelectItem>
                    <SelectItem value="uk">United Kingdom</SelectItem>
                    <SelectItem value="de">Germany</SelectItem>
                    <SelectItem value="ca">Canada</SelectItem>
                  </SelectContent>
                </Select>
              </Field>
              <Field orientation="horizontal" className="justify-between">
                <FieldLabel
                  htmlFor="default"
                  className="font-normal text-muted-foreground"
                >
                  Set as default payment method
                </FieldLabel>
                <Switch id="default" defaultChecked />
              </Field>
            </FieldGroup>

            <Button type="submit" className="w-full">
              Save card
            </Button>
            <p className="flex items-center justify-center gap-1.5 text-xs text-muted-foreground">
              <IconPlaceholder
                lucide="Lock"
                tabler="IconLock"
                hugeicons="LockIcon"
                phosphor="Lock"
                remixicon="RiLock2Line"
                className="size-3.5"
                aria-hidden="true"
              />
              Secured with 256-bit encryption
            </p>
          </form>
        </CardContent>
      </Card>
    </section>
  )
}
```
