Code And Chill

Quarto — Animated OTP Input (Verification Code)

Forms 4

About

A 4-digit OTP input that folds into a square, joins into one tile and turns into a check mark. Paste, autofill, keyboard and error state. SMS fill, resend timer and sounds in the full version: codeandchill.store/components/quarto?utm_source=21st

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Quarto — Animated OTP Input (Verification Code) to your project and fits it to your theme.

Code

How Quarto — Animated OTP Input (Verification Code) is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useEffect, useState } from "react";
import QuartoOtpField from "@/components/ui/quarto-otp-input";

const settings = {
  demoCode: "8402",
  destination: "+1 415 ••• 0142",
  checkMs: 620,
};

/** Quarto always opens dark, then follows the page's `dark` class only when it changes. */
function usePageTheme() {
  const [theme, setTheme] = useState<"dark" | "light">("dark");
  useEffect(() => {
    const html = document.documentElement;
    let last = html.classList.contains("dark");
    const mo = new MutationObserver(() => {
      const now = html.classList.contains("dark");
      if (now !== last) { last = now; setTheme(now ? "dark" : "light"); }
    });
    mo.observe(html, { attributes: true, attributeFilter: ["class"] });
    return () => mo.disconnect();
  }, []);
  return theme;
}

export default function Demo(props: Partial<typeof settings> = {}) {
  const s = { ...settings, ...props };
  const theme = usePageTheme();
  return (
    <div
      className="flex min-h-[100dvh] w-full items-center justify-center overflow-x-hidden px-5 py-10"
      style={{
        background: theme === "dark"
          ? "radial-gradient(70% 40% at 50% 0%, rgba(106,92,255,0.13), transparent 68%), radial-gradient(90% 55% at 50% 110%, rgba(47,227,155,0.05), transparent 64%), linear-gradient(180deg, #0e1017, #08090d 55%)"
          : "radial-gradient(70% 40% at 50% 0%, rgba(106,92,255,0.12), transparent 68%), radial-gradient(90% 55% at 50% 110%, rgba(15,174,116,0.07), transparent 64%), linear-gradient(180deg, #f3f3fb, #e8eaf3 55%)",
      }}
    >
      <QuartoOtpField
        demoCode={s.demoCode}
        destination={s.destination}
        checkMs={s.checkMs}
        theme={theme}
      />
    </div>
  );
}

Dependencies

More by Code And Chill

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    764
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    475
  • Hovira — Glassmorphism Smart Home Dashboard

    Hovira — Glassmorphism Smart Home Dashboard

    87
  • Vitra — Glass Pricing Section

    Vitra — Glass Pricing Section

    79
  • Halden — CRM Dashboard with Sales Pipeline

    Halden — CRM Dashboard with Sales Pipeline

    69
  • Kestrel — Marketing Analytics Dashboard

    Kestrel — Marketing Analytics Dashboard

    46
  • Money River — Sankey Money Flow Chart

    Money River — Sankey Money Flow Chart

    41
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    33

More in Forms

View all
  • Form

    Form

    7
  • Login 2

    Login 2

    16
  • Contact Form

    Contact Form

    33
  • Contact Card

    Contact Card

    1.1K
  • Book A Demo 1

    Book A Demo 1

    95
  • Premium Auth

    Premium Auth

    614
  • Onboarding Stepper

    Onboarding Stepper

    13
  • Authentication Card

    Authentication Card

    52