The --css-variable is the new, recommended way of styling shadow DOM. How do I use css variables to style distributed nodes?
Example:
<my-app>
<my-toolbar>
<paper-button disabled>done</paper-button>
</my-toolbar>
</my-app>
I'd like my-toolbar to apply different color to its content's paper-button[disabled].
paper-button exposes --paper-button-disabled variable to be used for styling its disabled state, so that's what I want to use.
My first attempt was to set '--paper-button-disabled' inside my-toolbar style definition:
<dom-template id='my-toolbar'>
<template>
<style>
:host {
--paper-button-disabled: {
background-color: yellow;
color: orange;
}
}
This does not work, because <paper-button> is light dom, not shadow dom.
I do not want to define '--paper-button-disabled' inside 'my-app' because disabled buttons outside of toolbar should not be orange.
And that is where I am stuck. What is the recommended way to style districuted nodes with css variables?
Aleks