ns-ui

Segmented Control Fling

Segmented control with a visibly grabbable pill (grip dots, hover lift) — fling it, it coasts on real release velocity, rubber-bands off the ends, and snaps into the nearest detent. Optional one-shot intro fling demos the mechanic on first view.

Use when a small horizontal set of exclusive views where the pill itself should be grabbable and coast to the nearest detent on release, while click and keyboard stay instant no-drag paths; pick radio-group-pin instead when the options stack vertically and their order carries meaning, or view-toggle-rails when switching also has to rearrange the content behind it.

Install

npx shadcn add https://design.helpmarq.com/r/segmented-control-fling.json
  • control
  • form
  • segmented
  • physics
  • drag

ns-ui / segmented-control-fling — grab the pill, fling it

Sprint 24 — Interaction polish

5 tasks · 2 in progress

  • NS-224Reduced-motion audit for registry demosNS
  • NS-231Detent capture tuning for trackpad flingsKM
  • NS-219Pointer-capture edge cases on iPadJL
  • NS-228Radiogroup keyboard pass on all controlsAR
  • NS-215Publish segmented-control docs pageNS

view / list · updated 2 min ago

sprint ends Jul 25

Click a segment and it switches instantly. Or grab the pill (the raised tab with the grip dots), throw it, and it coasts, bounces off the ends, and snaps into the nearest segment. Arrow keys work too.

Props

PropTypeDefaultDescription
options?FlingSegmentOption[]DEFAULT_OPTIONS
value?stringcontrolled value; omit for uncontrolled
defaultValue?string
onValueChange?(value: string) => voidfires once per selection change — on detent commit, never per-frame
introFling?booleanfalseopt-in one-shot self-demo: a beat after mount the pill is flung to the far segment, coasts, and captures into the detent. Plays exactly once, never loops, is skipped under reduced motion, and is permanently cancelled by any pointer or keyboard interaction.
className?string
aria-label?string"View"