DEV Community

Discussion on: Bringing Order to Web Design Chaos (with Web Components)

thatjoemoore profile image
Joseph Moore Author

In some of our components, we actually do! They can't do everything for us, though. For example, I'd love to make the setting of the mobile-to-desktop breakpoint in our header be a CSS property, but there isn't currently a way for Javascript to read that value, which we need in order to switch out our template when we move between mobile and desktop (we couldn't figure out a good pure CSS way to do it that conformed with the design we were given).

I'm really excited about CSS custom properties, but we just haven't had many opportunities to use them, as most of the components we've produced so far don't allow for much style customization.

equinusocio profile image
Mattia Astorino • Edited on

I understand. Anyway you can read custom property value with js from the element computed style with .getPropertyValue('--foo-bar'). Or set it with setProperty()