Blocks

Pricing 40

Pricing
3 ColumnsText Align LeftPricing Section
Pricing 40

Code

relume-pricing40.tsx
import { Button, type ButtonProps } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Check } from "relume-icons";

type Feature = {
  icon: React.ReactNode;
  text: string;
};

type PricingPlan = {
  planName: string;
  description: string;
  price: string;
  priceFrequency: string;
  discount?: string;
  features: Feature[];
  button: ButtonProps;
};

type Props = {
  tagline: string;
  heading: string;
  description: string;
  pricingPlans: PricingPlan[];
};

export type Pricing40Props = React.ComponentPropsWithoutRef<"section"> & Partial<Props>;

export const Pricing40 = (props: Pricing40Props) => {
  const { tagline, heading, description, pricingPlans } = {
    ...Pricing40Defaults,
    ...props,
  };
  return (
    <section className="px-[5%] py-16 md:py-24 lg:py-28">
      <div className="container">
        <div className="mb-12 md:mb-18 lg:mb-20">
          <p className="mb-3 font-semibold md:mb-4">{tagline}</p>
          <h1 className="mb-5 text-h2 font-bold md:mb-6">{heading}</h1>
          <p className="text-medium">{description}</p>
        </div>
        <div className="grid grid-cols-1 gap-8 lg:grid-cols-3">
          {pricingPlans.map((plan, index) => (
            <PricingPlan key={index} plan={plan} />
          ))}
        </div>
      </div>
    </section>
  );
};

const PricingPlan = ({ plan }: { plan: PricingPlan }) => (
  <Card className="flex h-full flex-col justify-start px-6 py-8 md:p-8">
    <h2 className="mb-1 text-h6 font-bold">{plan.planName}</h2>
    <p>{plan.description}</p>
    <div className="my-6 h-px w-full shrink-0 bg-scheme-border md:my-8" />
    <h3 className="mb-2 text-h1 font-bold">
      {plan.price}
      <span className="text-h4 font-bold">{plan.priceFrequency}</span>
    </h3>
    {plan.discount && <p>{plan.discount}</p>}
    <div className="mt-6 md:mt-8">
      <Button {...plan.button} className="w-full">
        {plan.button.title}
      </Button>
    </div>
    <div className="my-6 h-px w-full shrink-0 bg-scheme-border md:my-8" />
    <div className="grid grid-cols-1 gap-y-4 py-2">
      {plan.features.map((feature, index) => (
        <div key={index} className="flex self-start">
          <div className="mr-4 flex-none self-start">{feature.icon}</div>
          <p>{feature.text}</p>
        </div>
      ))}
    </div>
  </Card>
);

export const Pricing40Defaults: Props = {
  tagline: "Tagline",
  heading: "Pricing plan",
  description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  pricingPlans: [
    {
      planName: "Basic plan",
      description: "Lorem ipsum dolor sit amet",
      price: "$19",
      priceFrequency: "/mo",
      discount: "or $199 yearly",
      features: [
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
      ],
      button: { title: "Get started" },
    },
    {
      planName: "Business plan",
      description: "Lorem ipsum dolor sit amet",
      price: "$29",
      priceFrequency: "/mo",
      discount: "or $299 yearly",
      features: [
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
      ],
      button: { title: "Get started" },
    },
    {
      planName: "Enterprise plan",
      description: "Lorem ipsum dolor sit amet",
      price: "$49",
      priceFrequency: "/mo",
      discount: "or $499 yearly",
      features: [
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
        { icon: <Check className="size-6 text-scheme-text" />, text: "Feature text goes here" },
      ],
      button: { title: "Get started" },
    },
  ],
};

npm i @radix-ui/react-accordion @radix-ui/react-dialog @radix-ui/react-slot class-variance-authority@0.7.1 clsx@^2.1.1 embla-carousel-react@^8.5.2 motion@^12.15.0 relume-icons@1.3.0 tailwind-merge@^2.2.2