[fix] DataFrame content width horizontal alignment#12682
Merged
sfc-gh-lwilby merged 8 commits intodevelopfrom Oct 24, 2025
Merged
[fix] DataFrame content width horizontal alignment#12682sfc-gh-lwilby merged 8 commits intodevelopfrom
sfc-gh-lwilby merged 8 commits intodevelopfrom
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
✅ PR preview is ready!
|
Collaborator
Author
|
This change affects the resizing feature for |
Contributor
📉 Frontend coverage change detectedThe frontend unit test (vitest) coverage has decreased by 0.0000%
✅ Coverage change is within normal range. |
717a75c to
b8f7769
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes horizontal alignment for DataFrames when using width="content" in containers with horizontal alignment set. DataFrames with content width were previously wrapped in a full-width container that prevented proper horizontal alignment.
Key changes:
- Disabled resize functionality for DataFrames with
width="content"to allow natural flow and respect container alignment - Removed forced full-width styling from element containers for DataFrames and charts with content width
- Updated E2E tests to verify proper horizontal alignment behavior
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/lib/src/components/widgets/DataFrame/styled-components.ts |
Renamed prop from isInHorizontalLayout to disableResize and updated styling logic |
frontend/lib/src/components/widgets/DataFrame/ReadOnlyGrid.tsx |
Added width prop to support passing width configuration to DataFrame component |
frontend/lib/src/components/widgets/DataFrame/DataFrame.tsx |
Updated resize disable logic to check both horizontal layout and content width settings |
frontend/lib/src/components/elements/ArrowVegaLiteChart/ArrowVegaLiteChart.tsx |
Passed width configuration to ReadOnlyGrid for charts |
frontend/lib/src/components/core/Block/StyledElementContainerLayoutWrapper.tsx |
Removed forced full-width styling for DataFrames and charts with content width |
e2e_playwright/st_layouts_container_alignment.py |
Updated test to include DataFrame with content width in centered container |
frontend/lib/src/components/widgets/DataFrame/styled-components.ts
Outdated
Show resolved
Hide resolved
3b50f4b to
d403970
Compare
sfc-gh-bnisco
approved these changes
Oct 23, 2025
t0k0shi
added a commit
to t0k0shi/streamlit
that referenced
this pull request
Feb 1, 2026
Simplify the disableResize condition in DataFrame.tsx to only disable resize in horizontal layouts, restoring resize functionality for content-width DataFrames in normal, centered, sidebar, and tab layouts. The previous condition introduced in PR streamlit#12682 was overly broad, disabling resize for all content-width DataFrames outside the root container. Only horizontal layouts need resize disabled to prevent horizontal_alignment issues. Fixes streamlit#12683
t0k0shi
added a commit
to t0k0shi/streamlit
that referenced
this pull request
Feb 4, 2026
Simplify the disableResize condition in DataFrame.tsx to only disable resize in horizontal layouts, restoring resize functionality for content-width DataFrames in normal, centered, sidebar, and tab layouts. The previous condition introduced in PR streamlit#12682 was overly broad, disabling resize for all content-width DataFrames outside the root container. Only horizontal layouts need resize disabled to prevent horizontal_alignment issues. Fixes streamlit#12683
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.
Describe your changes
Fixes horizontal alignment for DataFrames when using
width="content"in containers withhorizontal_alignmentset.Changes Made:
width="content"were wrapped in a full-width container because the resize logic needed it to calculate available width. This wrapper prevented proper horizontal alignment.width="content"is used, resize handles are now disabled (similar to horizontal layouts) to prevent resizing beyond the parent container.width="content".Key Implementation:
The resize disable logic now checks both horizontal layout context AND content width setting. This allows DataFrames with content width to flow naturally and respect container alignment while preventing unwanted resizing.
GitHub Issue Link (if applicable)
N/A
Testing Plan
st_layouts_container_alignment.pyto test DataFrame withwidth="content"in centered containerScreenshots/Demos:
E2E test snapshots will show proper horizontal alignment of DataFrames with
width="content"in centered containers.Additional Notes:
This fix aligns DataFrame behavior with other elements that support
width="content"and properly respect container horizontal alignment.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.