242

Segmented Control

A slider under a row of options springs over to whichever you tap and resizes

Form & controlSwitchUI interactionApp UICSSCSS transition

Hannah's Motion Library
Web motion effects × AI prompts

AI prompt

A pill-shaped segmented control, e.g. “Day / Week / Month / Year”; a solid slider sits under the current option, and tapping another option slides it there with a slight bounce while resizing to fit the new label's width; the selected text switches to a color that contrasts with the slider. About 0.45 s. (CSS: the slider is absolutely positioned; JS reads the clicked button's offsetLeft and offsetWidth into CSS variables, transform:translateX(var(--x)) and width transition with cubic-bezier(.5,1.5,.5,1))

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 →