141

Toggle Switch

The knob stretches as it slides across and the track switches state

Form & controlHover & clickSwitchUI interactionApp UICSSCSS switch

Hannah's Motion Library
Web motion effects × AI prompts

AI prompt

A settings-page toggle in an app: on tap, the knob slides from one side to the other, stretching horizontally mid-slide and shrinking back (like springy jelly), overshooting slightly before settling; the track switches to the accent color when on and back to a low-contrast state when off. About 0.35 s. (CSS: button role="switch"; the knob transitions left with cubic-bezier(.5,1.4,.5,1) for the overshoot, plus keyframes that widen it at 50%; remember to update aria-checked)

When you copy it, a note to “match the site’s existing theme colors” is added automatically, so you don’t need to specify colors.

How to use it

  1. Tap “Copy AI prompt”.
  2. Paste it into an AI such as ChatGPT or Claude, and tell it which element on your site to apply it to (for example, the homepage headline or a buy button).
  3. The AI writes code that matches your site’s colors. Paste it into your project, then fine-tune the timing and distances.

More form & control effects

346 more motion effectsText, buttons, cards, backgrounds, cursors… preview them all and copy AI prompts

Browse all effects →