Billing 1
shadcnstore/billing-1FreeBlock
A subscription page with usage meters, payment method and invoice history
Install it
npx shadcn@latest add https://shadcnstore.com/r/billing-1.jsonSource
1'use client'23import { useEffect, useState } from 'react'4import { AlertTriangle, CreditCard, Download } from 'lucide-react'5import {6 AlertDialog,7 AlertDialogAction,8 AlertDialogCancel,9 AlertDialogContent,10 AlertDialogDescription,11 AlertDialogFooter,12 AlertDialogHeader,13 AlertDialogTitle,14 AlertDialogTrigger,15} from '@/components/ui/alert-dialog'16import { Badge } from '@/components/ui/badge'17import { Button } from '@/components/ui/button'18import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'19import {20 currentPlan,21 invoices,22 nearQuotaThreshold,23 paymentMethod,24 usageMeters,25 usageResetAt,26} from "@/components/data/billing-1-data"2728const money = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })29const number = new Intl.NumberFormat('en-US')30const longDate = new Intl.DateTimeFormat('en-US', { dateStyle: 'long' })31const shortDate = new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', year: 'numeric' })3233const statusClasses: Record<string, string> = {34 Paid: 'bg-primary/10 text-primary hover:bg-primary/10',35 Open: 'bg-secondary text-secondary-foreground hover:bg-secondary',36 Refunded: 'bg-muted text-muted-foreground hover:bg-muted',37}3839function Meter({ label, used, quota, unit }: (typeof usageMeters)[number]) {40 const fraction = used / quota41 const near = fraction >= nearQuotaThreshold42 const [width, setWidth] = useState(0)4344 // The bars fill once on mount. It is the only movement on the page, by design.45 useEffect(() => {46 const frame = window.requestAnimationFrame(() => setWidth(Math.min(fraction, 1) * 100))47 return () => window.cancelAnimationFrame(frame)48 }, [fraction])4950 return (51 <div>52 <div className='flex items-baseline justify-between gap-3'>53 <p className='text-sm font-medium'>{label}</p>54 <p className='text-muted-foreground text-sm tabular-nums'>55 {`${number.format(used)} of ${number.format(quota)}`}56 </p>57 </div>5859 <div60 role='progressbar'61 aria-valuemin={0}62 aria-valuemax={quota}63 aria-valuenow={used}64 aria-valuetext={`${number.format(used)} of ${number.format(quota)} ${unit} used, ${Math.round(fraction * 100)} percent`}65 className='bg-muted mt-2 h-1.5 w-full overflow-hidden rounded-full'66 >67 <div68 style={{ width: `${width}%` }}69// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from ShadcnStore
All 228 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| About 1about-1 | ShadcnStore | Blocks | Free | 1 dep · 3 files | |
| About 2about-2 | ShadcnStore | Blocks | Paid | 2 deps · 3 files | |
| AI Chat 1ai-chat-1 | ShadcnStore | Blocks | Free | 2 deps · 4 files | |
| AI Chat 2ai-chat-2 | ShadcnStore | Blocks | Paid | 1 dep · 4 files | |
| AI Prompt 1ai-prompt-1 | ShadcnStore | Blocks | Paid | 1 dep · 3 files | |
| App Dashboard 1app-1 | ShadcnStore | Blocks | Free | 1 dep · 4 files | |
| Task Management 2app-2 | ShadcnStore | Blocks | Paid | 2 deps · 4 files | |
| Foundational Application Shellapp-shell-1 | ShadcnStore | Blocks | Free | 1 dep · 4 files |
