-
Notifications
You must be signed in to change notification settings - Fork 4k
Change button styles #11964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change button styles #11964
Conversation
🎉 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) |
✅ PR preview is ready!
|
| "&:focus:not(:active)": { | ||
| borderColor: theme.colors.primary, | ||
| color: theme.colors.primary, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this 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
darkenedBgMix10would 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
Yes, all tested.
Yeah, we wanted to keep it consistent with those buttons.
Great find, fixed. |
There was a problem hiding this 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": { |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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.
lukasmasuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |

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
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.