Billing Vat Validator
A form for collecting and checking a business's VAT number before invoicing. A country selector prefixes the input, an explicit Validate click checks the number against a built-in per-country format pattern, and a short simulated delay stands in for a real VIES lookup. When a valid ID is entered for a country other than your own, a reverse-charge note appears.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, button, input, label dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-vat-validator.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing147.tsx instead.
Usage
The file also exports billing147Demo, 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 { Billing147, billing147Demo } from "@/components/blocks/billing/billing147"; export default function Page() { return <Billing147 {...billing147Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "VAT number validation" | Heading at the top of the form. |
| description | string | none | Optional one-line note under the heading. |
| baseCountryCode | string | "IE" | Your business's home country code, used to decide whether a valid ID counts as reverse charge. |
| countries | VatCountryOption[] | none | Countries offered as quick-select chips above the input. |
| defaultCountryCode | string | countries[0].code | Which country chip is active on first render. |
| validateLabel | string | "Validate" | Label on the validate button. |
| className | string | none | Extra classes for the outer container. |
Types
interface VatCountryOption { code: string; name: string; }
Behavior notes
- Validation only runs when the Validate button is clicked, not on every keystroke; typing in the input or switching country resets the result back to idle.
- Format checking uses a small built-in COUNTRY_DIGIT_PATTERNS map for DE, FR, IE, NL, ES, and IT; any other country code falls back to a generic 5-12 character alphanumeric pattern.
- A failed format check shows 'Not a valid format' immediately. A passing format check shows a brief 'Checking with VIES...' state for 900ms before flipping to valid, simulating a remote lookup with no real network call.
- The reverse-charge note only appears once state is 'valid' and the selected country differs from baseCountryCode.
- Country selection uses a chip-style radiogroup instead of a native select, since the UI kit has no Select primitive.
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.