Skip to content

Content alignment option for text elements #4109

@kaydotdev

Description

@kaydotdev

Problem

As a developer, I'd like to add an argument option to align text content for elements st.markdown, st.caption, and st.text. The available options of the alignment will be left (default option), center, right, and justify.

Solution

MVP:

>>> st.markdown('Lorem ipsum dolor sit amet...', align_text='left') # Default

align_left

>>> st.markdown('Lorem ipsum dolor sit amet...', align_text='center')

align_center

>>> st.markdown('Lorem ipsum dolor sit amet...', align_text='right')

align_right

>>> st.markdown('Lorem ipsum dolor sit amet...', align_text='justify')

align_justify

Possible additions: Add kwargs to the text elements for more flexible options input.


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

Views

Metadata

Metadata

Assignees

Labels

area:stylingRelated to styling and appearancefeature:markdownRelated to Markdown renderingfeature:st.captionRelated to the `st.caption` elementtype:enhancementRequests for feature enhancements or new features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions