[feat][TextAlignment] Adds text alignment parameter to st.text#13032
Merged
sfc-gh-lwilby merged 1 commit intodevelopfrom Nov 19, 2025
Merged
[feat][TextAlignment] Adds text alignment parameter to st.text#13032sfc-gh-lwilby merged 1 commit intodevelopfrom
st.text#13032sfc-gh-lwilby merged 1 commit 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. |
Collaborator
Author
Contributor
✅ PR preview is ready!
|
This was referenced Nov 18, 2025
st.text
67bc96f to
ea72594
Compare
5276414 to
52b3e19
Compare
ea72594 to
a4fb6de
Compare
52b3e19 to
3534c40
Compare
a0eca20 to
1fac3bd
Compare
3534c40 to
cc1a727
Compare
1fac3bd to
3ea3a2d
Compare
cc1a727 to
82cdfb7
Compare
3ea3a2d to
319b016
Compare
Contributor
📈 Python coverage change detectedThe Python unit test coverage has increased by 0.0495%
🎉 Great job on improving test coverage! Coverage by files
|
Base automatically changed from
11-03-text-alignment-frontend-styling
to
develop
November 19, 2025 04:54
319b016 to
9ca8e02
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a text_alignment parameter to st.text, allowing users to align text horizontally within the element using "left" (default), "center", "right", or "justify" options.
Key Changes
- Added
text_alignmentparameter to thest.textPython API with validation - Updated frontend styling to support inline help icons with text alignment
- Added comprehensive Python unit tests and E2E tests with snapshot testing
Reviewed Changes
Copilot reviewed 9 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/streamlit/elements/text.py | Added text_alignment parameter to st.text() method signature and documentation |
| lib/tests/streamlit/elements/text_test.py | Added parameterized tests for text alignment validation and protobuf value checking |
| frontend/lib/src/components/elements/TextElement/TextElement.tsx | Updated to nest help icon inside text span for proper alignment |
| frontend/lib/src/components/elements/TextElement/styled-components.ts | Changed from div to span for inline display and added inline help icon styling |
| frontend/lib/src/components/shared/TooltipIcon/styled-components.ts | Updated to ensure full width and proper centering for text alignment |
| frontend/lib/src/components/shared/TooltipIcon/index.ts | Reordered exports (cosmetic change) |
| e2e_playwright/st_text.py | Added test cases for all text alignment options with help tooltips |
| e2e_playwright/st_text_test.py | Added parameterized E2E test for visual validation of text alignment |
| e2e_playwright/shared/app_utils.py | Added get_text() utility function for locating text elements |
| e2e_playwright/snapshots/* | Added snapshot images for alignment validation across browsers |
lukasmasuch
approved these changes
Nov 19, 2025
Collaborator
There was a problem hiding this comment.
is the space in front of demonstrate expected? This is probably caused by the tab/spaces in front of demonstrate
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
Adds a new
text_alignmentparameter tost.text.GitHub Issue Link (if applicable)
#4109
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.