Skip to content

TabsPlugin: fix overflow and support vertical tabs#9511

Merged
Light2Dark merged 4 commits into
mainfrom
sham/update-tabs-plugin
May 12, 2026
Merged

TabsPlugin: fix overflow and support vertical tabs#9511
Light2Dark merged 4 commits into
mainfrom
sham/update-tabs-plugin

Conversation

@Light2Dark
Copy link
Copy Markdown
Collaborator

@Light2Dark Light2Dark commented May 12, 2026

📝 Summary

Closes #9482 and support vertical tabs

image image

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Copilot AI review requested due to automatic review settings May 12, 2026 02:26
@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment May 12, 2026 9:33pm

Request Review

@Light2Dark Light2Dark changed the title support vertical tabs and overflow-x-auto support vertical tabs and overflow properly May 12, 2026
@Light2Dark Light2Dark changed the title support vertical tabs and overflow properly TabsPlugin: support vertical tabs and overflow properly May 12, 2026
@Light2Dark Light2Dark changed the title TabsPlugin: support vertical tabs and overflow properly TabsPlugin: fix overflow and support vertical tabs May 12, 2026
@Light2Dark Light2Dark added bug Something isn't working enhancement New feature or request labels May 12, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"] to mo.ui.tabs and 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.

Comment thread marimo/_plugins/ui/_impl/tabs.py
Comment thread marimo/_smoke_tests/tabs.py
Comment thread frontend/src/plugins/impl/TabsPlugin.tsx
className={cn(
isVertical
? "flex flex-col items-stretch h-auto max-h-none shrink-0"
: "max-w-full overflow-x-auto justify-start",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do scrollbar-thin?

@kirangadhave
Copy link
Copy Markdown
Member

for the vertical tabs UI, can we have the tabs column span the entire height. Kinda like a sidebar. Right now the tabs are floating around (esp when there are only a few tabs)

Screenshot 2026-05-12 at 1 58 16 PM

@Light2Dark
Copy link
Copy Markdown
Collaborator Author

Thanks! Made the adjustment, could also do a design pass on this in the future.

@Light2Dark Light2Dark enabled auto-merge (squash) May 12, 2026 21:34
Copy link
Copy Markdown
Member

@kirangadhave kirangadhave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 looks great!

@Light2Dark Light2Dark merged commit 8977bc5 into main May 12, 2026
47 checks passed
@Light2Dark Light2Dark deleted the sham/update-tabs-plugin branch May 12, 2026 22:21
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.7-dev10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(minor) in server mode: mo.ui.tabs overflows horizontally with many tabs, no scroll/wrap option

4 participants