Skip to content

Detent Tabs

A range switcher with 2 to 4 options and a draggable thumb with magnetic detents. Continuous chart interpolation, value blending, and collision-free axis fading.

Dependencies

motionclsxtailwind-merge

Interaction

Direct manipulation range switcher. Dragging the thumb interpolates the chart SVG paths and metric values in real time with magnetic detent pull, settling into detents with tuned spring dynamics.

Props

PropTypeDescription
rangesDetentTabsRange[]Array of 2 to 4 range definitions with id, label, value, delta, points, and axis labels.
titlestringHeading text displayed in the header row.
formatValue(n: number) => stringFormatter function for the headline numerical value.
indexnumberControlled index for the active range detent.
defaultIndexnumberUncontrolled initial active range index.
onIndexChange(i: number) => voidCallback fired when a detent commits on release, click, or keyboard navigation.
classNamestringOptional CSS classes merged with the root container.

MIT License. Free to use in personal and commercial projects. Built for Peel UI.