extended-component-library icon indicating copy to clipboard operation
extended-component-library copied to clipboard

Use parts to allow customizing styles

Open maloua opened this issue 1 year ago • 4 comments

I would like to be able to control the styling of web components better, so that they are more in line with the rest of the design when necessary. For example: I'm using the gmpx-place-picker in a bigger form, and there's currently no way to change the input border.

A solution would be to use the part selector to target inner element when necessary.

An alternative would be to use more variables and less hardcoded values in the css and overwrite them. But I'm afraid that will either not be sufficiently detailed enough or bloat the code too much.

image

maloua avatar Mar 26 '24 12:03 maloua

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@maloua Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Mar 26 '24 12:03 wangela

Hey! Thanks for raising this. As you mention, we could make more aspects of the styling customizable with CSS variables, but this could end up reinventing the wheel. Exposing CSS ::part() could be a good approach for targeted elements like the input which are unlikely to change as part of the internal implementation.

awmack avatar Mar 26 '24 19:03 awmack

@awmack as @maloua Mentioned there is currently no way to style the border, the easiest solution would be to expose CSS variables until a more robust styling API is in place.

harisvsulaiman avatar Jun 26 '24 05:06 harisvsulaiman

Being able to style the input border, font style, and text color are necessary for a clean and consistent UI integration. For the input box, it's important also to be able to style the :focus pseudo elements as well.

dorsma avatar Feb 10 '25 16:02 dorsma