CSS Master Code Examples: Chapter 3 Custom Properties

Using Custom Properties with ReactJS Components

Here we've used JavaScript to set the value of --button-bg-color using the style attribute. Although this example uses ReactJS, the concept — setting the custom property via the style attribute — can be applied to other component-based frameworks.