Blocks

Pricing 2

Pricing
1 ColumnText Align CenterText Align LeftButtonsIconsList
Pricing 2

Code

relume-pricing2.tsx
import { Check, RelumeIcon } from "relume-icons";

import { Button, type ButtonProps } from "@/components/ui/button";
import { Card } from "@/components/ui/card";

type PricingPlan = {
  planName: string;
  monthlyPrice: string;
  yearlyPrice: string;
  features: string[];
  button: ButtonProps;
};

type Props = {
  tagline: string;
  heading: string;
  description: string;
  pricingPlan: PricingPlan;
};

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

export const Pricing2 = (props: Pricing2Props) => {
  const { tagline, heading, description, pricingPlan } = {
    ...Pricing2Defaults,
    ...props,
  };
  return (
    <section className="px-[5%] py-16 md:py-24 lg:py-28">
      <div className="container max-w-lg">
        <div className="mx-auto mb-12 max-w-lg text-center md:mb-18 lg:mb-20">
          <p className="mb-3 font-semibold md:mb-4">{tagline}</p>
          <h2 className="mb-5 text-h2 font-bold md:mb-6">{heading}</h2>
          <p className="text-medium">{description}</p>
        </div>
        <div className="container max-w-md">
          <PricingPlan plan={pricingPlan} />
        </div>
      </div>
    </section>
  );
};
const PricingPlan = ({ plan }: { plan: PricingPlan }) => (
  <Card className="h-full px-6 py-8 md:p-8">
    <div className="flex items-start justify-between">
      <h3 className="text-h6 font-bold">{plan.planName}</h3>
      <RelumeIcon className="size-12 text-scheme-text" />
    </div>
    <h4 className="mb-2 text-h1 font-bold">
      {plan.monthlyPrice}
      <span className="text-h4 font-bold">/mo</span>
    </h4>
    <p>or {plan.yearlyPrice} yearly</p>
    <div className="my-6 h-px w-full shrink-0 bg-scheme-border md:my-8" />
    <p className="mb-2">Includes:</p>
    <div className="mt-3 grid grid-cols-1 gap-y-4 py-2 md:mt-4">
      {plan.features.map((feature, index) => (
        <div className="flex self-start">
          <div className="mr-4 flex-none self-start">
            <Check className="size-6 text-scheme-text" />
          </div>
          <p>{feature}</p>
        </div>
      ))}
    </div>
    <div>
      <Button {...plan.button} className="mt-6 w-full md:mt-8">
        {plan.button.title}
      </Button>
    </div>
  </Card>
);

export const Pricing2Defaults: Props = {
  tagline: "Tagline",
  heading: "Pricing plan",
  description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  pricingPlan: {
    planName: "Basic plan",
    monthlyPrice: "$19",
    yearlyPrice: "$199",
    features: [
      "Feature text goes here",
      "Feature text goes here",
      "Feature text goes here",
      "Feature text goes here",
      "Feature text goes here",
    ],
    button: { title: "Get started" },
  },
};

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