BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/billui/plan-group

Plan Group

billui/plan-group
FreeComponent

A container for displaying multiple pricing plans with a monthly/yearly toggle.

Live preview

live · rendered by the registry
Rendered by billui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://billui.com/r/plan-group.json

Source

src/registry/ui/plan-group.tsxbillui.com/r/plan-group.json · first 6 KB
1"use client";
2
3import { cva, type VariantProps } from "class-variance-authority";
4import * as React from "react";
5
6import { cn } from "@/lib/utils";
7import { PlanCardPrice } from "./plan-card";
8
9const planGroupVariants = cva("w-full", {
10 variants: {
11 layout: {
12 horizontal: "grid gap-6",
13 vertical: "flex flex-col gap-6",
14 },
15 columns: {
16 2: "md:grid-cols-2",
17 3: "lg:grid-cols-3",
18 4: "lg:grid-cols-2 xl:grid-cols-4",
19 },
20 },
21 defaultVariants: {
22 layout: "horizontal",
23 columns: 2,
24 },
25});
26
27type BillingPeriod = "month" | "year";
28
29interface PlanGroupContextValue {
30 period: BillingPeriod;
31 setPeriod: (period: BillingPeriod) => void;
32}
33
34const PlanGroupContext = React.createContext<PlanGroupContextValue | null>(
35 null,
36);
37
38function usePlanGroup() {
39 const context = React.useContext(PlanGroupContext);
40 if (!context) {
41 throw new Error("usePlanGroup must be used within a PlanGroup");
42 }
43 return context;
44}
45
46interface PlanGroupProps
47 extends React.HTMLAttributes<HTMLDivElement>,
48 VariantProps<typeof planGroupVariants> {
49 defaultPeriod?: BillingPeriod;
50 onPeriodChange?: (period: BillingPeriod) => void;
51}
52
53const PlanGroup = React.forwardRef<HTMLDivElement, PlanGroupProps>(
54 (
55 {
56 className,
57 layout,
58 columns,
59 defaultPeriod = "month",
60 onPeriodChange,
61 children,
62 ...props
63 },
64 ref,
65 ) => {
66 const [period, setPeriodState] =
67 React.useState<BillingPeriod>(defaultPeriod);
68
69 const setPeriod = React.useCallback(
70 (newPeriod: BillingPeriod) => {
71 setPeriodState(newPeriod);
72 onPeriodChange?.(newPeriod);
73 },
74 [onPeriodChange],
75 );
76
77 return (
78 <PlanGroupContext.Provider value={{ period, setPeriod }}>
79 <div ref={ref} className={cn("space-y-8", className)} {...props}>
80 {children}
81 </div>
82 </PlanGroupContext.Provider>
83 );
84 },
85);
86PlanGroup.displayName = "PlanGroup";
87
88const PlanGroupHeader = React.forwardRef<
89 HTMLDivElement,
90 React.HTMLAttributes<HTMLDivElement>
91>(({ className, ...props }, ref) => (
92 <div
93 ref={ref}
94 className={cn("flex flex-col items-center gap-4 text-center", className)}
95 {...props}
96 />
97));
98PlanGroupHeader.displayName = "PlanGroupHeader";
99
100const PlanGroupTitle = React.forwardRef<
101 HTMLHeadingElement,
102 React.HTMLAttributes<HTMLHeadingElement>
103>(({ className, ...props }, ref) => (
104 <h2
105 ref={ref}
106// … truncated

What it pulls in

npm packages

  • class-variance-authority

Other registry items

  • https://billui.com/r/utils.json
  • https://billui.com/r/plan-card.json

Files it writes

  • src/registry/ui/plan-group.tsx

Facts

Registry
billui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on billui billui.com commet-labs/billui on GitHub Raw registry item This item as JSON

More from billui

All 13 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Animated Usage Cardanimated-usage-cardbilluiComponentsFree2 deps
Billing Addressbilling-addressbilluiComponentsFreeno deps
Card Iconscard-iconsbilluiComponentsFree1 dep
Card Inputcard-inputbilluiComponentsFreeno deps
Invoice Cardinvoice-cardbilluiComponentsFree2 deps
Payment Methodpayment-methodbilluiComponentsFree2 deps
Plan Cardplan-cardbilluiComponentsFree2 deps
Pricing Tablepricing-tablebilluiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex