|
| 1 | +--- |
| 2 | +title: Billing Screen |
| 3 | +description: Complete billing dashboard with credit balance, plan details, and interactive credit card visual |
| 4 | +--- |
| 5 | + |
| 6 | +<Tabs items={['Preview', 'Code']} className="bg-transparent border-none"> |
| 7 | + <Tab value="Preview" className="border-none bg-transparent p-0 mt-3"> |
| 8 | + <PreviewComponents registryName="billing-screen"> |
| 9 | + <BillingScreenDemo /> |
| 10 | + </PreviewComponents> |
| 11 | + </Tab> |
| 12 | + |
| 13 | + <Tab value="Code" className="mt-3"> |
| 14 | + <include cwd lang="tsx" meta='title="src/components/billing-screen-demo.tsx"'>src/components/billing-screen-demo.tsx</include> |
| 15 | + </Tab> |
| 16 | +</Tabs> |
| 17 | + |
| 18 | +## Installation |
| 19 | + |
| 20 | +<Tabs items={['shadcn', 'billingSDK']} defaultValue="shadcn" className="bg-transparent border-none"> |
| 21 | + <Tab value="shadcn" className="border-none bg-transparent p-0 mt-3"> |
| 22 | + <Tabs items={['npx', 'pnpm', 'yarn', 'bun']} defaultValue="npx" groupId="installation-tabs"> |
| 23 | + <Tab value="npx"> |
| 24 | + ```bash |
| 25 | + npx shadcn@latest add @billingsdk/billing-screen |
| 26 | + ``` |
| 27 | + </Tab> |
| 28 | + <Tab value="pnpm"> |
| 29 | + ```bash |
| 30 | + pnpm dlx shadcn@latest add @billingsdk/billing-screen |
| 31 | + ``` |
| 32 | + </Tab> |
| 33 | + <Tab value="yarn"> |
| 34 | + ```bash |
| 35 | + yarn dlx shadcn@latest add @billingsdk/billing-screen |
| 36 | + ``` |
| 37 | + </Tab> |
| 38 | + <Tab value="bun"> |
| 39 | + ```bash |
| 40 | + bunx shadcn@latest add @billingsdk/billing-screen |
| 41 | + ``` |
| 42 | + </Tab> |
| 43 | + </Tabs> |
| 44 | + </Tab> |
| 45 | + <Tab value="billingSDK" className="border-none bg-transparent p-0 mt-3"> |
| 46 | + <Tabs items={['npx', 'pnpm', 'yarn', 'bun']} defaultValue="npx" groupId="billingsdk-cli-tabs"> |
| 47 | + <Tab value="npx"> |
| 48 | + ```bash |
| 49 | + npx @billingsdk/cli add billing-screen |
| 50 | + ``` |
| 51 | + </Tab> |
| 52 | + <Tab value="pnpm"> |
| 53 | + ```bash |
| 54 | + pnpm dlx @billingsdk/cli add billing-screen |
| 55 | + ``` |
| 56 | + </Tab> |
| 57 | + <Tab value="yarn"> |
| 58 | + ```bash |
| 59 | + yarn dlx @billingsdk/cli add billing-screen |
| 60 | + ``` |
| 61 | + </Tab> |
| 62 | + <Tab value="bun"> |
| 63 | + ```bash |
| 64 | + bunx @billingsdk/cli add billing-screen |
| 65 | + ``` |
| 66 | + </Tab> |
| 67 | + </Tabs> |
| 68 | + </Tab> |
| 69 | +</Tabs> |
| 70 | + |
| 71 | +## Usage |
| 72 | + |
| 73 | +```tsx |
| 74 | +import { BillingScreen } from "@/components/billingsdk/billing-screen"; |
| 75 | +``` |
| 76 | + |
| 77 | +```tsx |
| 78 | +<BillingScreen |
| 79 | + planName="Premium Plan" |
| 80 | + planPrice="$20/mo" |
| 81 | + renewalDate="Oct 7, 2025" |
| 82 | + totalBalance="$6.59" |
| 83 | + username="rajoninternet" |
| 84 | + giftedCredits="$1.73" |
| 85 | + monthlyCredits="$3.13" |
| 86 | + monthlyCreditsLimit="$20.00" |
| 87 | + purchasedCredits="$0.00" |
| 88 | + resetDays={4} |
| 89 | + autoRechargeEnabled={false} |
| 90 | + onViewPlans={() => console.log("View Plans clicked")} |
| 91 | + onCancelPlan={() => console.log("Cancel Plan clicked")} |
| 92 | + onBuyCredits={() => console.log("Buy Credits clicked")} |
| 93 | + onEnableAutoRecharge={() => console.log("Enable Auto-recharge clicked")} |
| 94 | + className="w-full" |
| 95 | +/> |
| 96 | +``` |
| 97 | + |
| 98 | +## Props |
| 99 | + |
| 100 | +| Prop | Type | Required | Description | |
| 101 | +|------|------|----------|-------------| |
| 102 | +| `className` | `string` | ❌ | Additional CSS classes | |
| 103 | +| `planName` | `string` | ❌ | Name of the current plan (default: "Premium Plan") | |
| 104 | +| `planPrice` | `string` | ❌ | Price of the current plan (default: "$20/mo") | |
| 105 | +| `renewalDate` | `string` | ❌ | Date when the plan renews (default: "Oct 7, 2025") | |
| 106 | +| `totalBalance` | `string` | ❌ | Total available credit balance (default: "$6.59") | |
| 107 | +| `username` | `string` | ❌ | Username displayed on credit card (default: "rajoninternet") | |
| 108 | +| `giftedCredits` | `string` | ❌ | Amount of gifted credits (default: "$1.73") | |
| 109 | +| `monthlyCredits` | `string` | ❌ | Amount of monthly credits used (default: "$3.13") | |
| 110 | +| `monthlyCreditsLimit` | `string` | ❌ | Total monthly credit limit (default: "$20.00") | |
| 111 | +| `purchasedCredits` | `string` | ❌ | Amount of purchased credits (default: "$0.00") | |
| 112 | +| `resetDays` | `number` | ❌ | Days until monthly credits reset (default: 4) | |
| 113 | +| `autoRechargeEnabled` | `boolean` | ❌ | Whether auto-recharge is enabled (default: false) | |
| 114 | +| `onViewPlans` | `() => void` | ❌ | Callback when "View Plans" button is clicked | |
| 115 | +| `onCancelPlan` | `() => void` | ❌ | Callback when "Cancel Plan" button is clicked | |
| 116 | +| `onBuyCredits` | `() => void` | ❌ | Callback when "Buy Credits" button is clicked | |
| 117 | +| `onEnableAutoRecharge` | `() => void` | ❌ | Callback when auto-recharge toggle is clicked | |
| 118 | + |
| 119 | +## Theming |
| 120 | + |
| 121 | +The component is styled using the `shadcn/ui` library. You can customize the colors and fonts by overriding the CSS variables. You can also get the theme from the [Theming](/docs/theming) page. |
| 122 | + |
| 123 | +## Example |
| 124 | +<include cwd lang="tsx" meta='title="src/components/billing-screen-demo.tsx"'>src/components/billing-screen-demo.tsx</include> |
| 125 | + |
| 126 | +## Credits |
| 127 | + |
| 128 | +- Created by [@rajoninternet](https://x.com/rajoninternet) |
0 commit comments