Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jrieke
Copy link
Collaborator

@jrieke jrieke commented Jul 17, 2025

Describe your changes

Changes the styles of buttons to this:

Screenshot.2025-07-17.at.16.46.40.mp4

GitHub Issue Link (if applicable)

Testing Plan

  • Updated snapshots
  • No additional tests since this is just a small visual change
  • Manually tested all different buttons, including primary/secondary/tertiary types, colored text, and disabled

Contribution License Agreement

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

@snyk-io
Copy link
Contributor

snyk-io bot commented Jul 17, 2025

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

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 17, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-11964/streamlit-1.46.1-py3-none-any.whl
🕹️ Preview app pr-11964.streamlit.app (☁️ Deploy here if not accessible)

@jrieke jrieke added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Jul 17, 2025
@jrieke jrieke changed the title [Prototype] Change button styles Change button styles Jul 17, 2025
@jrieke jrieke marked this pull request as ready for review July 17, 2025 15:51
@lukasmasuch lukasmasuch requested a review from Copilot July 17, 2025 15:53

This comment was marked as outdated.

Comment on lines -151 to -153
"&:focus:not(:active)": {
borderColor: theme.colors.primary,
color: theme.colors.primary,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I think this was used to show the button via the primary color if it was selected via tab? Is it intended that we don't apply a different look other than the border shadow?

Copy link
Collaborator Author

@jrieke jrieke Jul 17, 2025

Choose a reason for hiding this comment

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

Looked into this again. I decided to make the focus-visible style the same as the hover style for all buttons (+ focus-visible additionally shows the focus ring via box shadow). This way, the button gets properly highlighted when tabbing but doesn't keep the hovered style after it was pressed but is still in focus (which is annoying and was the reason I removed this previously).

Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍 But a couple of thoughts:

  • Do we also want to change this for pills and segmented button?
  • Have you tested this that its also applied correctly with download, popover, and form button?
  • The hover feels slightly too dark... maybe something like darkenedBgMix10 would be better here. But probably fine since we are using the same color for menus as well.
  • There is a bit of weirdness if the button label contains any form of coloured text:
Screen.Recording.2025-07-17.at.18.05.18.mov

@jrieke
Copy link
Collaborator Author

jrieke commented Jul 17, 2025

Do we also want to change this for pills and segmented button?

Probably yes, still discussing with Jessi, will play around in a separate PR. OK added it to this PR.

Have you tested this that its also applied correctly with download, popover, and form button?

Yes, all tested.

The hover feels slightly too dark... maybe something like darkenedBgMix10 would be better here. But probably fine since we are using the same color for menus as well.

Yeah, we wanted to keep it consistent with those buttons.

There is a bit of weirdness if the button label contains any form of coloured text:

Great find, fixed.

@jrieke jrieke requested a review from Copilot July 17, 2025 23:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the styling behavior of buttons across the Streamlit frontend, changing how they appear during hover, focus, and active states. The changes standardize the visual feedback patterns and improve the user experience by making button interactions more consistent.

Key changes include:

  • Consolidating hover and focus-visible styles using combined selectors
  • Updating primary button hover colors to use darker shades and consistent border colors
  • Replacing secondary button color-changing hover effects with background color changes
  • Simplifying tertiary button interactions by moving primary color application from active to hover state

Reviewed Changes

Copilot reviewed 2 out of 47 changed files in this pull request and generated no comments.

File Description
frontend/lib/src/components/shared/BaseButton/styled-components.ts Updates button styling for all button types (primary, secondary, tertiary, ghost) and button groups with new hover/focus behaviors
frontend/lib/src/components/elements/LinkButton/styled-components.ts Applies the same styling changes to link buttons to maintain consistency with regular buttons

color: "inherit !important",
},
},
"&:focus": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These were redundant since they are already in the base class.

width: containerWidth ? "100%" : "auto",
cursor: "pointer",
userSelect: "none",
"&:hover": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is only required for tertiary button now, so moved it there.

Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM. One minor observation: when hovering segmented button, the left border seems to be more highlighted than the right border:

image

@jrieke
Copy link
Collaborator Author

jrieke commented Jul 18, 2025

One minor observation: when hovering segmented button, the left border seems to be more highlighted than the right border:

Yeah this is because the background color and border color both have transparency and overlap. Played around with this for a while and tried out different alternatives but can't really find a good one. I'll merge this as is for now and will file a task to investigate this more in Q3.

@jrieke jrieke enabled auto-merge (squash) July 18, 2025 15:28
@jrieke jrieke merged commit 5601852 into develop Jul 18, 2025
38 checks passed
@jrieke jrieke deleted the feature/new-button-styles branch July 18, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement 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.

3 participants