Skip to content

refactor!: Checkbox, Checkbox Group and Radio Button Group base styles #9154

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

Open
wants to merge 14 commits into
base: base-styles
Choose a base branch
from

Conversation

jouni
Copy link
Member

@jouni jouni commented May 14, 2025

Checkbox, Checkbox Group and Radio Button Group base styles

Supported custom properties

Checkbox

Property Description
--vaadin-checkbox-background Background color of the checkbox.
--vaadin-checkbox-border-color Border color of the checkbox.
--vaadin-checkbox-border-radius Border radius of the checkbox.
--vaadin-checkbox-border-width Border width of the checkbox.
--vaadin-checkbox-color Color used for the checkmark or indeterminate icon.
--vaadin-checkbox-gap Gap between the checkbox and the label.
--vaadin-checkbox-label-color Text color of the checkbox label.
--vaadin-checkbox-label-font-size Font size of the checkbox label.
--vaadin-checkbox-label-font-weight Font weight of the checkbox label.
--vaadin-checkbox-label-line-height Line height of the checkbox label.
--vaadin-checkbox-size Size (width and height) of the checkbox.
--vaadin-checkbox-group-gap The gap between the group label and the checkboxes within the group.

Radio Button

Property Description
--vaadin-radio-button-background Background color of the radio-button.
--vaadin-radio-button-border-color Border color of the radio-button.
--vaadin-radio-button-border-radius Border radius of the radio-button.
--vaadin-radio-button-border-width Border width of the radio-button.
--vaadin-radio-button-color Color used for the selection dot in the radio-button.
--vaadin-radio-button-gap Gap between the radio-button and the label.
--vaadin-radio-button-label-color Text color of the radio-button label.
--vaadin-radio-button-label-font-size Font size of the radio-button label.
--vaadin-radio-button-label-font-weight Font weight of the radio-button label.
--vaadin-radio-button-label-line-height Line height of the radio-button label.
--vaadin-radio-button-size Size (width and height) of the radio-button.
--vaadin-radio-button-dot-size Size (width and height) of the selection dot in the radio-button.
--vaadin-radio-button-group-gap The gap between the group label and the radio-buttons within the group.

@jouni
Copy link
Member Author

jouni commented May 14, 2025

Going to update the visual tests still.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe this needs to be extracted to component-base package, now that Radio Group depends on it?

Copy link
Member

Choose a reason for hiding this comment

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

IMO we can extract this to field-base/styles and call it something like group-base-styles.js

jouni added 3 commits May 19, 2025 22:32
The part is a `<span>` in some components and a `<div>` in others.
@jouni
Copy link
Member Author

jouni commented May 19, 2025

@web-padawan, could you take a look at the tests? I can't figure out why they fail. I get the failure locally as well, but I can reproduce the issue in the dev page.

@web-padawan
Copy link
Member

We could modify this test to not check for display: block but store original value using getComputedStyle(checkbox) and then check if that is restored. Otherwise we'd also have to add add styles to the Polymer version which makes no sense.

 ❌ checkbox > default > should have display: none when hidden
      AssertionError: expected 'inline-grid' to equal 'none'
      + expected - actual
      
      -inline-grid
      +none

@jouni
Copy link
Member Author

jouni commented May 20, 2025

I think that issue was just about importing the Lit version, which includes more CSS than the Polymer version.

@jouni
Copy link
Member Author

jouni commented May 20, 2025

I think it was a similar issue with the tooltip integration test, and I tried updating all the components to the Lit versions that already have base styles.

@web-padawan
Copy link
Member

Regarding component-tooltip tests - I recall there was an issue in the original checkbox PR that the tooltip wasn't open because the group had zero height without children (in the main branch, it had some height due to pseudo-element).

See this commit for a fix (needs to be also applied to RadioGroup in that test): 0458e1d

Copy link

@jouni
Copy link
Member Author

jouni commented May 20, 2025

I assume we should redo these updates on top of main instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants