Skip to content

No.289 · Navigation

Slide Tabs

Tabs with one shared indicator that stretches like elastic between them — the leading edge moves first, the trailing edge follows.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Design a pill-shaped tab bar with a single shared indicator. The bar is a near-black plum capsule with a hairline border; tabs are 40px-tall pills with muted labels. Behind the active tab sits a frost-tinted capsule (soft gradient, 1px frost inner ring, small glow). The indicator is positioned with left and right offsets measured from the active tab, and those two properties are transitioned separately: when moving forward the right (leading) edge moves immediately while the left (trailing) edge waits 90ms, and the delays swap when moving backward. Both use cubic-bezier(0.16,1,0.3,1) over 420ms, so the capsule visibly stretches across the gap like elastic and then snaps to the new size. Panels crossfade and rise 8px. Implement the ARIA tabs pattern exactly: role=tablist/tab/tabpanel, aria-selected, aria-controls and aria-labelledby, roving tabindex, ←/→ wrap-around, Home/End, and focusable panels. Recompute the indicator on resize. The list scrolls horizontally without a scrollbar if it overflows on small screens. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click or use ←/→/Home/End; the indicator stretches from the old tab to the new one. Motion: Indicator left/right 420ms ease-out-expo with a 90ms edge offset; panel fade 420ms. Accessibility: Full ARIA tabs pattern with roving tabindex and keyboard navigation. Reduced motion removes the stretch delay and panel animation. Responsive behavior: Horizontal scroll (no scrollbar) when tabs exceed the container. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Click or use ←/→/Home/End; the indicator stretches from the old tab to the new one.
Motion
Indicator left/right 420ms ease-out-expo with a 90ms edge offset; panel fade 420ms.
Accessibility
Full ARIA tabs pattern with roving tabindex and keyboard navigation. Reduced motion removes the stretch delay and panel animation.
Responsive
Horizontal scroll (no scrollbar) when tabs exceed the container.