|
| 1 | +--- |
| 2 | +title: Billing Settings 3 |
| 3 | +description: A user-centric billing dashboard featuring wallet balance, spend visualization, and liquid UI payment methods. |
| 4 | +--- |
| 5 | + |
| 6 | +import { BillingSettingsThree } from "@/components/billingsdk/billing-settings-three"; |
| 7 | +import BillingSettingsThreeDemo from "@/registry/billingsdk/demo/billing-settings-three-demo"; |
| 8 | + |
| 9 | +A user-facing dashboard component `BillingSettingsThree` for managing billing, wallet balance, and payment methods. |
| 10 | + |
| 11 | +## Preview |
| 12 | + |
| 13 | +<Tabs items={['Preview', 'Code']} className="bg-transparent border-none"> |
| 14 | + <Tab value="Preview" className="border-none bg-transparent p-0 mt-3"> |
| 15 | + <PreviewComponents registryName="billing-settings-3"> |
| 16 | + <BillingSettingsThreeDemo /> |
| 17 | + </PreviewComponents> |
| 18 | + </Tab> |
| 19 | + |
| 20 | + <Tab value="Code" className="mt-3"> |
| 21 | + <include cwd lang="tsx" meta='title="src/registry/billingsdk/demo/billing-settings-three-demo.tsx"'>src/registry/billingsdk/demo/billing-settings-three-demo.tsx</include> |
| 22 | + </Tab> |
| 23 | +</Tabs> |
| 24 | + |
| 25 | +## Features |
| 26 | + |
| 27 | +- **Minimalist Metrics**: Clean, static display of wallet balances, spend amounts, and trend percentages for maximum stability and clarity. |
| 28 | +- **Trend Indicators**: Built-in support for displaying positive/negative trends with automatic color coding and icons. |
| 29 | +- **Liquid Payment Methods**: Smooth, animated "liquid" list for adding/removing payment methods with high-fidelity transitions. |
| 30 | +- **Smart Brand Recognition**: Automatically displays high-quality icons for Visa, Mastercard, AMEX, and Rupay, with a fallback to standard card icons if external assets fail to load. |
| 31 | +- **Flexible "Add New" Logic**: Support for both in-app modal callbacks (`onAddNew`) and direct external redirects (`addNewHref`). |
| 32 | +- **Minimalist Aesthetic**: Features a zero-animation `minimal` mode that removes background decorative elements for a clean dashboard look. |
| 33 | + |
| 34 | +## Usage |
| 35 | + |
| 36 | +```tsx |
| 37 | +import { BillingSettingsThree } from "@/components/billingsdk/billing-settings-three"; |
| 38 | +import { BillingProvider } from "@/lib/i18n-provider"; |
| 39 | + |
| 40 | +export default function BillingPage() { |
| 41 | + const handleAddNew = () => { |
| 42 | + console.log("Open payment method modal"); |
| 43 | + }; |
| 44 | + |
| 45 | + return ( |
| 46 | + <BillingProvider> |
| 47 | + <BillingSettingsThree |
| 48 | + balance={1250.00} |
| 49 | + balanceTrend={15.4} |
| 50 | + spend={432.50} |
| 51 | + spendTrend={-5.2} |
| 52 | + theme="classic" |
| 53 | + onAddNew={handleAddNew} |
| 54 | + // Or use addNewHref="/billing/payment-methods/new" |
| 55 | + /> |
| 56 | + </BillingProvider> |
| 57 | + ); |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +## Props |
| 62 | + |
| 63 | +| Prop | Type | Default | Description | |
| 64 | +| ---- | ---- | ------- | ----------- | |
| 65 | +| `balance` | `number` | `1250.00` | The current wallet balance to display. | |
| 66 | +| `balanceTrend` | `number` | `12.5` | Percentage change in balance (e.g., `15.4` for +15.4%). | |
| 67 | +| `balanceTrendLabel` | `string` | `"from last month"` | Label shown next to the balance trend. | |
| 68 | +| `spend` | `number` | `432.50` | The total spend for the current period. | |
| 69 | +| `spendTrend` | `number` | `-2.4` | Percentage change in spend (e.g., `-5.2` for -5.2%). | |
| 70 | +| `spendTrendLabel` | `string` | `"Current billing cycle"` | Label shown next to the spend trend. | |
| 71 | +| `currency` | `string` | `"USD"` | The currency code (e.g., "USD", "EUR"). | |
| 72 | +| `theme` | `"minimal" \| "classic"` | `"minimal"` | The visual theme variant. | |
| 73 | +| `paymentMethods` | `PaymentMethod[]` | `[...]` | Array of payment objects: `{ id, type, last4, expiry, isDefault }`. | |
| 74 | +| `transactions` | `Transaction[]` | `[...]` | Array of transactions: `{ id, description, amount, date, status }`. | |
| 75 | +| `onAddNew` | `() => void` | `undefined` | Callback for "Add New" button (e.g., to open a modal). | |
| 76 | +| `addNewHref` | `string` | `undefined` | URL for "Add New" button redirect (fallback if `onAddNew` is not provided). | |
| 77 | + |
| 78 | +## Installation |
| 79 | + |
| 80 | +<Tabs defaultValue="manual"> |
| 81 | + |
| 82 | +<TabsList> |
| 83 | + <TabsTrigger value="manual">Manual</TabsTrigger> |
| 84 | + <TabsTrigger value="cli">CLI</TabsTrigger> |
| 85 | +</TabsList> |
| 86 | + |
| 87 | +<TabsContent value="manual"> |
| 88 | + |
| 89 | +Copy the code from `src/components/billingsdk/billing-settings-three.tsx` into your project. |
| 90 | + |
| 91 | +</TabsContent> |
| 92 | + |
| 93 | +<TabsContent value="cli"> |
| 94 | + |
| 95 | +```bash |
| 96 | +npx shadcn@latest add "https://billingsdk.com/r/billing-settings-3.json" |
| 97 | +``` |
| 98 | + |
| 99 | +</TabsContent> |
| 100 | + |
| 101 | +</Tabs> |
0 commit comments