|
|
|
|
|
by hunterloftis
165 days ago
|
|
> It'd be perfect it just had a switch to inherit everything the page already has. It does! <https://lit.dev/docs/components/shadow-dom/> By default, Lit renders into shadow DOM. This carries benefits like encapsulation (including the style encapsulation you mention). If you prefer global styles, you can render into light DOM instead with that one-line switch. However, shadow DOM is required for slotting (composing) components, so typically what I'd recommend for theming is leveraging the array option of each component's styles: static styles = [themeStyles, componentStyles]
Then you define your shared styles in `themeStyles`, which is shared across all components you wish to have the same theme. |
|
https://github.com/gitaarik/lit-style