
Horizontal Feature Reveal
Scroll
A set of three animated icon toggle buttons, a chevron flip, a cross, and a plus-to-minus, whose box switches between inactive and active colors.
Animated Toggle gives a button or link a small, useful moment of feedback: a binary choice confirms state.
Use it where an icon control needs to feel responsive and intentional, not theatrical. A button should confirm action, state, or direction; it should not become a tiny stage play that delays the click.
The thing to watch is keeping the markup honest. Use genuine button and anchor elements, preserve focus, fire instantly, and make loading and disabled states obvious. The animation decorates the action; it is never the action.
import AnimatedToggle from "@/components/effects/animated-toggle"; export default function AnimatedTogglePage() { return ( <> <section className="min-h-dvh w-full flex items-center relative justify-center"> <div className="flex gap-8 justify-center"> <AnimatedToggle/> </div> </section> </> );}A furniture retailer can use Animated Toggle on its product pages for the controls that open and close detail panels: a plus that turns into a minus for care instructions, a chevron that flips for the size guide, and a cross for dismissing a delivery note. Each box also switches between its inactive and active color.
The outcome is clarity of state. Shoppers can see at a glance which panels are open, and each control is a real button that responds on the first press.
Not for destructive actions, unclear states, or places where animation hides the label or delays activation.
Keep feedback fast, avoid layout-triggering letter movement, and preserve instant activation.
Use real buttons or anchors, visible focus-visible styles, and clear loading/disabled states. Touch targets should stay large enough on mobile.
| Prop | Type | Default | Description |
|---|---|---|---|
size | number | 96 | Overall toggle box size in pixels. |
activeColor | color | #ff5f00 | Box color when a toggle is active. |
inactiveColor | color | #a1a1aa | Box color when a toggle is inactive. |
duration | number | 0.32 | Icon transition duration in seconds. |
Use it when an expand, collapse, or dismiss control needs a binary choice that confirms state without delaying the action.
Yes. Use `<button>` for actions and `<a>` for navigation.
Use visible focus-visible styles and support keyboard activation.
Loading should be visually clear and programmatically communicated without hiding the label.
Remove long staggers, scrambles, and looping emphasis while keeping instant state feedback.
Need a custom effect? Tell us what to create.