Vilqor

Pricing Section with Toggle

Pricing

About

Three plans with a monthly and yearly switch. The featured plan is lit from above and its button carries a sheen; a soft light follows the pointer; prices are formatted per locale. Part of Midnight, the full template on 21st.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Pricing Section with Toggle to your project and fits it to your theme.

Code

How Pricing Section with Toggle is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useSyncExternalStore, type CSSProperties } from "react"

import { PricingPlans } from "@/components/ui/pricing-plans"

// Midnight by day: Fraunces headings, Geist text, Geist Mono figures, one deep gold accent
const fonts =
  "@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..600,0..100;1,9..144,300..600,0..100&family=Geist:wght@400..600&family=Geist+Mono:wght@400..500&display=swap');"

const settings = {
  label: "Pricing",
  title: "Plans that grow with you.",
  yearlyNote: "Save 20%",
  paper: "#f7f5f0",
  card: "#ffffff",
  ink: "#141a2e",
  muted: "#4a5166",
  primary: "#a8803a",
}

// Midnight by night, the template's own palette
const night: Partial<typeof settings> = {
  paper: "#0b1020",
  card: "#111731",
  ink: "#ece9e1",
  muted: "#a9afc4",
  primary: "#d9b77e",
}

// 21st marks its dark theme with .dark on <html>; the demo answers with Midnight by night
function useDark() {
  return useSyncExternalStore(
    (on) => {
      const watch = new MutationObserver(on)
      watch.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] })
      return () => watch.disconnect()
    },
    () => document.documentElement.classList.contains("dark"),
    () => false,
  )
}

function day(s: typeof settings, dark: boolean) {
  const t: Record<string, string> = {
    background: s.paper,
    foreground: s.ink,
    card: s.card,
    primary: s.primary,
    "primary-foreground": dark ? "#0b1020" : "#ffffff",
    "muted-foreground": s.muted,
    ring: s.primary,
  }
  return {
    ...Object.fromEntries(Object.entries(t).flatMap(([k, v]) => [[`--${k}`, v], [`--color-${k}`, v]])),
    "--font-display": "Fraunces, ui-serif, Georgia, serif",
    "--font-sans": "Geist, ui-sans-serif, system-ui, sans-serif",
    "--font-mono": "'Geist Mono', ui-monospace, Menlo, monospace",
  } as CSSProperties
}

export default function Demo(props: Partial<typeof settings>) {
  const dark = useDark()
  const s = { ...settings, ...props, ...(dark ? night : {}) }
  return (
    <div
      className="flex min-h-svh w-full justify-center px-6 py-16"
      style={{ ...day(s, dark), fontFamily: "Geist, ui-sans-serif, system-ui, sans-serif", background: s.paper, color: s.ink } as CSSProperties}
    >
      <style>{fonts}</style>
      <div className="w-full max-w-[1120px]">
        <p className="flex items-center justify-center gap-2 text-[12px] leading-4 tracking-[0.16em] uppercase" style={{ fontFamily: "var(--font-mono)", color: dark ? "#e3c592" : "#8a6a2e" }}>
          <svg viewBox="-6 -6 12 12" className="size-2.5" aria-hidden="true">
            <path d="M0 -6Q0 0 6 0Q0 0 0 6Q0 0 -6 0Q0 0 0 -6Z" fill="currentColor" />
          </svg>
          {s.label}
        </p>
        <h2
          className="mt-5 text-center text-[40px] leading-[1.04] font-[350] tracking-[-0.02em] text-balance md:text-[56px]"
          style={{ fontFamily: "var(--font-display)", fontVariationSettings: '"SOFT" 50' }}
        >
          {s.title}
        </h2>
        <PricingPlans
          className="mt-8"
          yearlyNote={s.yearlyNote}
          plans={[
            {
              name: "Starter",
              monthly: 0,
              yearly: 0,
              unit: "/ month",
              blurb: "For side projects and trying things out.",
              features: ["1 project", "Community templates", "Basic analytics", "Email support"],
              cta: "Start free",
            },
            {
              name: "Pro",
              monthly: 24,
              yearly: 19,
              unit: "/ month",
              blurb: "For freelancers and small teams shipping every week.",
              features: ["Unlimited projects", "Custom domains", "Advanced analytics", "Priority support"],
              cta: "Start 14-day trial",
              featured: true,
            },
            {
              name: "Business",
              monthly: 59,
              yearly: 49,
              unit: "/ month",
              blurb: "For companies that need control and an SLA.",
              features: ["Roles and permissions", "SSO and audit log", "99.9% uptime SLA", "A named contact"],
              cta: "Talk to sales",
              href: "#",
            },
          ]}
        />
      </div>
    </div>
  )
}

Dependencies

More by Vilqor

View all
  • 3D Glass Cube Hero

    3D Glass Cube Hero

    210
  • Footer with Big Wordmark

    Footer with Big Wordmark

    163
  • Guilloche Background Pattern

    Guilloche Background Pattern

    8
  • Card Carousel to Grid

    Card Carousel to Grid

  • AI Email Reply with Tones

    AI Email Reply with Tones

  • AI Memory Timeline

    AI Memory Timeline

  • Use Cases Tabs Section

    Use Cases Tabs Section

  • Logo Cloud Marquee

    Logo Cloud Marquee

More in Pricing

View all
  • Pricing Section 1

    Pricing Section 1

    109
  • Toggle Pricing Cards

    Toggle Pricing Cards

    111
  • Executive Pricing Plan

    Executive Pricing Plan

    20
  • Single Pricing Card

    Single Pricing Card

    828
  • Pricing Section

    Pricing Section

    733
  • Pricing Card

    Pricing Card

    589
  • pricing section

    pricing section

    190
  • Pricing Card With Features

    Pricing Card With Features

    195