fix label alignment#9486
Merged
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 2 files
Architecture diagram
sequenceDiagram
participant Render as Labeled Renderer
participant DOM as Browser DOM
participant CSS as Tailwind CSS
Note over Render,CSS: Label alignment flow (PR fix for PR #9100 regression)
Render->>DOM: Render `<div part="label" class="inline-flex items-center m-0 p-0">`
DOM->>CSS: Apply `inline-flex` and `items-center` to label wrapper
alt Inline (side) label mode (e.g., switch, checkbox, inline radio)
CSS->>CSS: `inline-flex` makes wrapper shrink-wrap content
CSS->>CSS: `items-center` vertically centers label text with control
Note over Render,CSS: Fixes regression: label text now aligns vertically with control center
else Top label mode (e.g., text, number, dropdown, code_editor)
CSS->>CSS: `inline-flex` has no visible effect (block context from parent)
CSS->>CSS: Label renders above control as before
else Table label mode (flush table output)
DOM->>DOM: Inherits `--marimo-table-edge-padding` via wrapper div
CSS->>CSS: `inline-flex` + `items-center` correctly centers table label
end
Note over Render,CSS: Key property change: added `inline-flex` and `items-center`
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a UI regression where mo.ui.switch (and other side-labeled controls using Labeled) render their label text vertically misaligned relative to the control, and adds a dedicated smoke-test notebook for manual visual verification of label positioning across configurations.
Changes:
- Update the
Labeledcomponent’s label wrapper to useinline-flex items-centerto restore vertical centering for side-aligned labels. - Add a new
labels.pysmoke test notebook covering multiple label layouts (inline/side, top/full-width, markdown labels, tables) for manual regression checking.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
marimo/_smoke_tests/labels.py |
Adds a manual visual smoke test notebook exercising label alignment across a range of labeled UI components. |
frontend/src/plugins/impl/common/labeled.tsx |
Adjusts the label wrapper’s layout classes to vertically center label content next to controls. |
mscolnick
approved these changes
May 9, 2026
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
Fixes #9481 . Doesn't break tables
📋 Pre-Review Checklist
✅ Merge Checklist