TabsPlugin: fix overflow and support vertical tabs#9511
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
No issues found across 5 files
Architecture diagram
sequenceDiagram
participant PyKernel as Python Kernel
participant TabsPy as tabs() UIElement
participant Frontend as Frontend (React)
participant TabsComp as TabComponent
participant TabsList as TabsList (Radix)
participant TabsTrigger as TabsTrigger (Radix)
participant Labeled as Labeled wrapper
Note over PyKernel,Frontend: Initial render flow — NEW: orientation parameter
PyKernel->>TabsPy: tabs({...}, orientation="vertical"|"horizontal")
TabsPy->>TabsPy: NEW: Accept orientation kwarg (Literal["horizontal","vertical"])
TabsPy->>Frontend: Send args: {"tabs": [...], "orientation": "vertical"}
Note right of Frontend: orientation defaults to "horizontal" for back-compat
Frontend->>TabsComp: render(props) – receives orientation in data
TabsComp->>TabsComp: CHANGED: Check orientation === "vertical"
alt Vertical orientation
TabsComp->>TabsComp: NEW: Add flex-row/items-start CSS classes to Tabs wrapper
TabsComp->>TabsList: NEW: Use className="flex-col items-stretch h-auto max-h-none"
TabsComp->>TabsTrigger: NEW: Use className="w-full justify-start"
TabsComp->>TabsComp: NEW: Wrap children in `<div className="flex-1 min-w-0">`
else Horizontal orientation (default)
TabsComp->>TabsList: CHANGED: Use className="max-w-full overflow-x-auto justify-start"
Note over TabsList,Labeled: Fix for overflow bug #9482 — enables horizontal scroll
end
TabsComp->>Labeled: Pass fullWidth={true} for vertical layout
Note over Labeled: NEW: fullWidth prop allows tab content to fill available space
Note over PyKernel,Frontend: User interaction — tab selection (unchanged)
User->>TabsTrigger: Click tab
TabsTrigger->>TabsList: onValueChange(index)
TabsList->>Frontend: setValue(index)
Frontend->>PyKernel: POST value update
PyKernel-->>TabsPy: Update value attribute
Note over TabsComp: Fallback path — no orientation from older kernels
alt Orientation omitted (back-compat)
Frontend->>TabsComp: data.orientation defaults to "horizontal"
TabsComp->>TabsList: Apply horizontal styling (scroll)
end
Note over TabsComp: Test validation — new assertions
Test->>TabsComp: Verify vertical mode applies flex-col class
Test->>TabsComp: Verify horizontal overflow-x-auto is absent in vertical
Test->>TabsPy: Verify orientation defaults when omitted
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the mo.ui.tabs UI element to better handle large tab sets by adding a vertical orientation option and making horizontal tab bars scrollable when they overflow (addressing #9482).
Changes:
- Added
orientation: Literal["horizontal", "vertical"]tomo.ui.tabsand wired it through to the frontend plugin. - Updated the frontend tabs rendering to support vertical layout and horizontal overflow scrolling.
- Added backend + frontend tests, plus a new tabs smoke-test notebook.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/_plugins/ui/_impl/test_tabs.py | Adds unit tests asserting default and vertical orientation propagation. |
| marimo/_plugins/ui/_impl/tabs.py | Adds orientation parameter and sends it to the frontend via component args. |
| frontend/src/plugins/impl/TabsPlugin.tsx | Implements vertical layout and horizontal overflow scrolling behavior. |
| frontend/src/plugins/impl/tests/TabsPlugin.test.tsx | Adds vitest coverage for orientation behavior and tab selection. |
| marimo/_smoke_tests/tabs.py | Adds a manual/CI smoke test notebook covering overflow + vertical tabs scenarios. |
mscolnick
reviewed
May 12, 2026
| className={cn( | ||
| isVertical | ||
| ? "flex flex-col items-stretch h-auto max-h-none shrink-0" | ||
| : "max-w-full overflow-x-auto justify-start", |
Contributor
There was a problem hiding this comment.
could we do scrollbar-thin?
Member
Collaborator
Author
|
Thanks! Made the adjustment, could also do a design pass on this in the future. |
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.7-dev10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

📝 Summary
Closes #9482 and support vertical tabs
📋 Pre-Review Checklist
✅ Merge Checklist