Billing Address Form
A billing address form for account settings or checkout flows, with borderless inputs for a cleaner look than boxed form fields. It collects a country, street address, city, state, postal code, and an optional tax ID or VAT number, validates the required fields on submit, and shows a saving state followed by a confirmation.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its input, label, button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-address-form.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing17.tsx instead.
Usage
The file also exports billing17Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Billing17, billing17Demo } from "@/components/blocks/billing/billing17"; export default function Page() { return <Billing17 {...billing17Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Billing address" | Heading above the form. |
| description | string | "Used for invoices and tax calculation." | Supporting sentence under the heading. |
| countries | CountryOption[] | none | Options rendered in the country select, in the order given. |
| defaultValues | Partial<BillingAddressValues> | none | Initial field values. Any field left out starts blank, except country which falls back to the first entry in countries. |
| saveLabel | string | "Save changes" | Label on the submit button. |
| className | string | none | Extra classes for the outer card. |
Types
interface CountryOption { code: string; name: string; } interface BillingAddressValues { country: string; line1: string; line2: string; city: string; state: string; postalCode: string; taxId: string; }
Behavior notes
- Country is a native HTML select, not a custom dropdown component, so it works without JavaScript and inherits the borderless input styling.
- On submit, line1, city, postalCode, and country are required; state, address line 2, and tax ID are optional and never block submission.
- A successful submit sets a saving state for 700ms before showing a Saved confirmation, standing in for a real network request. Swap the setTimeout in handleSubmit for your actual save call.
- Editing any field after a failed or successful submit clears that field's error and resets the status back to idle.
- Errors are shown per field under the input rather than in a single summary block, and invalid fields get aria-invalid so assistive tech announces them.
Frequently asked questions
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.