ham7a311

Gel Toggle

Component

About

A playful on/off switch whose thumb behaves like a drop of gel, stretching into a gooey bridge as it slides and squashing when it lands, with the track filling behind it in the accent color.

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

Code

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

Usage.tsx

"use client";

import GelToggle from "@/components/ui/gel-toggle";

const ROWS = [
  {
    id: "wifi",
    label: "Wi-Fi",
    note: "Home Network",
    accent: "#34c77b",
    defaultChecked: true,
  },
  {
    id: "focus",
    label: "Focus",
    note: "Until 18:00",
    accent: "#7c5cff",
    defaultChecked: false,
  },
  {
    id: "low",
    label: "Low power",
    note: "Battery at 22%",
    accent: "#ffb02e",
    defaultChecked: false,
  },
];

export default function Demo() {
  return (
    <div className="flex min-h-full w-full items-center justify-center bg-[#efede8] p-8 text-[#1b1a17]">
      <ul className="w-full max-w-sm divide-y divide-black/[0.07] rounded-[20px] bg-white px-5 shadow-[0_20px_40px_-24px_rgb(0_0_0/0.35)]">
        {ROWS.map((r) => (
          <li
            key={r.id}
            className="flex items-center justify-between gap-4 py-4"
          >
            <span>
              <span className="block text-[15px] font-medium">{r.label}</span>
              <span className="block text-[13px] opacity-55">{r.note}</span>
            </span>
            <GelToggle
              label={r.label}
              accent={r.accent}
              defaultChecked={r.defaultChecked}
            />
          </li>
        ))}
      </ul>
    </div>
  );
}

More by ham7a311

View all
  • Wave Mesh

    Wave Mesh

    198
  • Route Globe

    Route Globe

    162
  • Glass Tiles

    Glass Tiles

    151
  • Orbit Ring Stats

    Orbit Ring Stats

    63
  • Glyph Swell

    Glyph Swell

    60
  • Ask Bar

    Ask Bar

    51
  • Fan Deck Card

    Fan Deck Card

    43
  • Intent Label

    Intent Label

    41