Billing Email Preferences
A settings panel for billing email notifications. Each notification type gets its own working toggle switch, and any marked as locked (like failed-payment alerts) render disabled and always on with a short note explaining why. An optional accounting email field lets a second recipient receive invoices, and the save button shows a loading state followed by a brief confirmation. Built for SaaS account settings and enterprise billing portals.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button, input, label dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-email-preferences.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing53.tsx instead.
Usage
The file also exports billing53Demo, 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 { Billing53, billing53Demo } from "@/components/blocks/billing/billing53"; export default function Page() { return <Billing53 {...billing53Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Email preferences" | Panel heading. |
| description | string | "Choose which billing emails you want to receive." | Supporting line under the heading. |
| preferences | EmailPreferenceItem[] | none | Notification rows rendered in order, each with its own toggle state. |
| accountingEmailLabel | string | "Also send invoices to" | Label above the accounting email field. |
| defaultAccountingEmail | string | "" | Starting value of the accounting email field. |
| saveLabel | string | "Save preferences" | Label on the save button in its idle state. |
| className | string | none | Extra classes for the outer container. |
Types
interface EmailPreferenceItem { id: string; label: string; description?: string; defaultEnabled?: boolean; locked?: boolean; lockedNote?: string; }
Behavior notes
- Each preference's toggle state is local, seeded from defaultEnabled (true if omitted), and locked items are always forced on regardless of defaultEnabled.
- A locked preference's switch is a real disabled button, it renders visibly on but can't be clicked, and lockedNote (if set) explains why underneath the description.
- Saving is a local simulation: clicking Save preferences disables the button, shows a spinner for about 700ms, then a checkmark and 'Preferences saved' for 2 seconds before resetting. Nothing is persisted, wire your own API call into a wrapper if you fork this.
- The accounting email field has no format validation built in, it's a plain controlled input, add your own check before submitting if the format matters.
- Every toggle is a real button with role="switch" and aria-checked, so preferences work with keyboard navigation and screen readers, not just pointer clicks.
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.