Toggle Icon Morph
A switch with a glyph inside the thumb: the two strokes of the cross swing and re-join into a check as the thumb rolls across.
toggleswitchiconmorphcheck
Installation
Run the shadcn CLI in a project with Tailwind CSS. The component lands in components/pixelpapa/toggle-icon-morph.tsx.
$pnpm dlx shadcn@latest add "https://pixelpapa.com/r/toggle-icon-morph.json"Manual install+
1. Install the dependencies.
$pnpm add motion2. Copy the code from the Code tab above into your project. It imports the cn helper from @/lib/utils, which every shadcn project already has.
Build it with AI
Prefer to let an agent do the wiring? Copy this prompt, describe where the component should go, and paste.
AI prompt
Paste into Claude, Cursor, v0 or Lovable
Add the "Toggle Icon Morph" component from PixelPapa UI to this project. What it is: A switch with a glyph inside the thumb: the two strokes of the cross swing and re-join into a check as the thumb rolls across. Category: Toggles & Switches. Depends on: motion. 1. Install it with the shadcn CLI: npx shadcn@latest add "https://pixelpapa.com/r/toggle-icon-morph.json" (If the CLI is unavailable, fetch that URL, write files[0].content to components/pixelpapa/toggle-icon-morph.tsx and install the listed dependencies.) 2. Import it from "@/components/pixelpapa/toggle-icon-morph" and place it where I describe below. 3. Keep its animation timings and accessibility attributes. Replace the demo copy and data with content that fits my product, and use my existing theme tokens (bg-background, text-foreground, bg-primary, border-border) rather than hard-coded colours. Where to use it: <describe the page and position here>
More toggles & switches
- Toggle Day NightA theme switch drawn as a tiny sky: the sun rolls across and becomes a cratered moon, clouds sink away and stars pop out one by one.
- Toggle iOS With Label ListA settings card of labelled switches under a master toggle; turning the master off folds the dependent rows away with a staggered collapse.
- Toggle Like BookmarkIcon toggles that each fill in their own way: the heart pops, the bookmark drops in from above, the star spins and the bell rings, all with a ring burst.
- Toggle Lock ShakeA switch that can be locked: clicking it then shakes its head, rattles the padlock in the thumb and pops up the reason it cannot change.
- Toggle Segmented ThemeA light / dark / system picker with a sliding thumb and icons that react when chosen, paired with a miniature window that wipes between themes and splits in two for "system".
- Toggle Spring SwitchA switch whose thumb stretches toward the other side while pressed, then snaps across with a little overshoot on release.