Just launchedPattern Paste: copy-paste WordPress block patterns and theme styles
Back to UI Elements

Elastic Segmented Switch

£5 Standard License Unlimited projects

Segmented control whose lime indicator springs between options with elastic easing; for billing toggles and settings.

intermediate
3 more details
micro-interactionelasticclick-state

About This Component

Segmented control whose lime indicator springs between options with elastic easing; for billing toggles and settings. A single self-contained component: one HTML file, one stylesheet, one script, vanilla JavaScript and GSAP, no framework. Ships in three looks, vault, soft and paper, switched with one data-variant attribute; the script is identical in all three.

What's Included

6 items
  • Indicator measures the active button, so labels can be any width
  • elastic.out(1, 0.75) spring on every change
  • Native <button> options, keyboard accessible
  • Re-measures after web fonts load and on resize
  • Add or remove options in HTML only
  • Three shipped variants: vault, soft, paper

Perfect For

3 use cases
  • Monthly / Annual / Lifetime billing toggles
  • View switchers in dashboards
  • Settings and filter groups

How It Works

1 section

Measured indicator

On click the active button is measured relative to the bar and the indicator tweens x and width to match with elastic easing. left is 0 in CSS so the measured x is the whole offset.

Difficulty Intermediate
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates
£5

Premium UI Element

Elastic Segmented Switch

Purchase this ui element to unlock the full source code and implementation.

£5 Standard License Unlimited projects
Browse UI Elements

Your Cart

Your cart is empty

Browse Effects