cult/ui

Halo Switch

Forms 3

About

A toggle switch with a spring-animated thumb, frosted translucent track, and an enlarged touch hit area for mobile-friendly settings rows.

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

Code

How Halo Switch is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import HaloSwitch from "@/components/ui/halo-switch";
import { useState } from "react";

export default function HaloSwitchDemo() {
  const [notifyOn, setNotifyOn] = useState(true);
  const [compact, setCompact] = useState(false);

  return (
    <main className="flex w-full flex-col items-center justify-center">
      <div className="w-full max-w-md space-y-10">
        <section className="space-y-3">
          <h2 className="font-semibold text-foreground text-lg tracking-tight">
            Default
          </h2>
          <p className="text-pretty text-muted-foreground text-sm">
            Toggles on and off with a spring-animated thumb and an enlarged tap
            target for easier touch use.
          </p>
          <div className="flex items-center gap-4">
            <HaloSwitch
              checked={notifyOn}
              onCheckedChange={setNotifyOn}
              translucent
            />
            <span className="text-muted-foreground text-sm">
              Notifications {notifyOn ? "on" : "off"}
            </span>
          </div>
        </section>

        <section className="space-y-3">
          <h2 className="font-semibold text-foreground text-lg tracking-tight">
            Small
          </h2>
          <p className="text-pretty text-muted-foreground text-sm">
            A smaller footprint for dense toolbars and compact settings rows.
          </p>
          <div className="flex items-center gap-4">
            <HaloSwitch
              checked={compact}
              onCheckedChange={setCompact}
              size="sm"
              translucent
            />
            <span className="text-muted-foreground text-sm">
              Compact mode {compact ? "on" : "off"}
            </span>
          </div>
        </section>
      </div>
    </main>
  );
}

Dependencies

More by cult/ui

View all
  • 3D Carousel

    3D Carousel

    2.5K
  • Logo Carousel

    Logo Carousel

    1.1K
  • Feature Carousel

    Feature Carousel

    504
  • Popover Form

    Popover Form

    419
  • Floating Panel

    Floating Panel

    245
  • Expandable

    Expandable

    126
  • Dock

    Dock

    119
  • Hero Liquid Metal

    Hero Liquid Metal

    101

More in Forms

View all
  • Premium Auth

    Premium Auth

    500
  • Login 1

    Login 1

    52
  • Book A Demo 3

    Book A Demo 3

    83
  • Authentication Card

    Authentication Card

    47
  • Contact Card

    Contact Card

    1K
  • Login Card

    Login Card

    32
  • Book A Demo 1

    Book A Demo 1

    69
  • Login 2

    Login 2

    7

Explore more

Part of cult ui — browse the full library on 21st.dev.