Billing Settings 2
billingsdk/billing-settings-2FreeBlock
A comprehensive billing settings component with tabs for general, payment methods, invoices, and usage limits
Install it
npx shadcn@latest add https://billingsdk.com/r/billing-settings-2.jsonSource
1"use client";23import { Button } from "@/components/ui/button";4import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";5import { Input } from "@/components/ui/input";6import { Label } from "@/components/ui/label";7import {8 Select,9 SelectContent,10 SelectItem,11 SelectTrigger,12 SelectValue,13} from "@/components/ui/select";14import { Switch } from "@/components/ui/switch";15import { cn } from "@/lib/utils";16import { useState, useMemo } from "react";17import currencyCodes from "currency-codes";1819// Define types for our props20export interface FeatureToggle {21 id: string;22 label: string;23 description: string;24 enabled: boolean;25 onToggle: (enabled: boolean) => void;26}2728export interface InputField {29 id: string;30 name: string;31 value?: string;32 defaultValue?: string;33 placeholder: string;34 onChange: (value: string) => void;35 label: string;36 helperText?: string;37 type?: "text" | "email" | "tel" | "url" | "number";38 required?: boolean;39 validation?: {40 minLength?: number;41 maxLength?: number;42 pattern?: RegExp;43 customValidator?: (value: string) => string | null;44 };45}4647export interface ValidationError {48 field: string;49 message: string;50}5152export interface BillingSettings2Props {53 className?: string;54 title?: string;55 features?: FeatureToggle[];56 inputFields?: InputField[];57 onSave?: () => void;58 onCancel?: () => void;59 saveButtonText?: string;60 cancelButtonText?: string;61 currencies?: string[]; // Array of currency codes to show (e.g., ['USD', 'EUR', 'GBP'])62 currencyOptions?: { value: string; label: string }[]; // Override for custom currency options63 defaultCurrency?: string;64 onCurrencyChange?: (value: string) => void;65 enableValidation?: boolean;66 currencyRequired?: boolean;67}6869// Validation helper functions70const validateEmail = (email: string): string | null => {71 const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;72 if (!emailRegex.test(email)) {73 return "Please enter a valid email address";74 }75 return null;76};7778const validateField = (value: string, field: InputField): string | null => {79 // Check required validation80 if (field.required && !value.trim()) {81 return `${field.label} is required`;82 }8384 // Skip other validations if field is empty and not required85 if (!value.trim() && !field.required) {86 return null;87 }8889 // Check email validation90 if (field.type === "email") {91 return validateEmail(value);92 }9394 // Check custom validation95// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from billingsdk
All 35 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| All Componentsall | billingsdk | Blocks | Free | no deps | |
| Top Bannerbanner | billingsdk | Blocks | Free | 2 deps · 2 files | |
| Billing Screenbilling-screen | billingsdk | Blocks | Free | 2 deps · 2 files | |
| Billing Settingsbilling-settings | billingsdk | Blocks | Free | 2 deps · 2 files | |
| Cancel Subscription Cardcancel-subscription-card | billingsdk | Blocks | Free | 1 dep · 3 files | |
| Cancel Subscription Dialogcancel-subscription-dialog | billingsdk | Blocks | Free | 1 dep · 3 files | |
| Detailed Usage Tabledetailed-usage-table | billingsdk | Blocks | Free | no deps · 2 files | |
| Hello World Componenthello-world | billingsdk | Blocks | Free | no deps |
