Skip to content

Conversation

@sfc-gh-lwilby
Copy link
Collaborator

Describe your changes

Fixes color picker shrinking below its intrinsic size when width < 40px is specified.

Changes Made:

  • Added minWidth: theme.sizes.minElementHeight to StyledColorPicker to prevent container from shrinking below the 40x40px color block
  • Uses same theme value as color block to keep them synchronized

GitHub Issue Link

Fixes #12872

Testing Plan

  • E2E Tests (added snapshot test for width=20 case)
  • Manual testing completed

Additional Notes:

The color block has a hard-coded width of theme.sizes.minElementHeight (40px). Without a corresponding minWidth on the container, specifying width < 40px caused the label to shrink while the color block stayed fixed, creating visual inconsistency.


Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@sfc-gh-lwilby sfc-gh-lwilby added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Nov 6, 2025
@snyk-io
Copy link
Contributor

snyk-io bot commented Nov 6, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12962/streamlit-1.51.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12962.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-lwilby sfc-gh-lwilby changed the title Fix st.color_picker minimum width constraint [fix] st.color_picker minimum width constraint Nov 6, 2025
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have a note to follow up on migrating this away from themed_app, but for this PR I am leaving it since the test has other snapshots as well.

@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review November 7, 2025 17:54
@sfc-gh-lwilby sfc-gh-lwilby merged commit a7713a7 into develop Nov 8, 2025
40 of 41 checks passed
@sfc-gh-lwilby sfc-gh-lwilby deleted the fix/color-picker-minimum-width branch November 8, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st.color_picker should have 40px minimum width

3 participants