I'll create scrollable tabs with automatic scroll buttons that are visible on desktop and hidden on mobile, using shadcn/ui components.
This scrollable tabs component includes:
Key Features:
- Horizontal scrolling tabs that work on both mobile and desktop
- Automatic scroll buttons that appear only on desktop (
hidden md:flex) - Smart button states - buttons are disabled/faded when you can't scroll further
- Smooth scrolling behavior with 200px increments
- Responsive design - scroll buttons hidden on mobile, natural touch scrolling enabled
Technical Implementation:
- Uses
useRef to control the scroll container useState to track scroll button availability- Event listeners for scroll and resize to update button states
- CSS to hide scrollbars while maintaining functionality
- Proper accessibility with disabled states
Design Details:
- Scroll buttons are positioned absolutely with proper z-index
- Buttons have shadow and border for visual separation
- Hover states and proper spacing
- Uses shadcn/ui design tokens and components1
The tabs will scroll naturally on mobile with touch gestures, while desktop users get the convenient scroll buttons for precise navigation.