shadcn.io is not affiliated with official shadcn/ui
Tabs examples · Layout
Scrollable Tabs for React
Twelve month tabs in a scroll area, so the list scrolls sideways instead of wrapping.
Twelve tabs do not fit in a narrow column, and wrapping them breaks the row. A ScrollArea around TabsList keeps the months on one line and scrolls them sideways. Use it for dates, categories or any long run of tabs read in order.
Preview
Installation
FAQ
How does the tab list scroll?
ScrollArea wraps TabsList with w-full whitespace-nowrap. The list keeps its natural width, so January to December overflow the max-w-md area and scroll.
A ScrollBar with orientation="horizontal" sits inside the ScrollArea.
How are the twelve months built?
A months array is mapped twice, once for triggers and once for panels. Each value is the lowercased month name, and the default is january.
Does each month get a panel?
Yes. Each panel shows the month and 2024, a muted paragraph and two stat boxes, Total Tasks and Completed.
Where do the task counts come from?
From the months array: each month has its own total and completed. The numbers are fixed, so they match between server and client renders and stay the same when you come back to a month.
Related
- Vertical TabsSettings tabs stacked in a column beside
- Full Width TabsThree tabs that split the full width of
- Basic TabsFour horizontal tabs that switch between
- Basic ScrollArea Scroll AreaA basic vertical scroll area for long
- Standard CarouselA basic carousel of five numbered slides
- Controlled TabsThree step tabs held in state, with