Splendid UI
Components and utilities for the modern web
-->
setCSSVar
lets you set the value of a CSS variable.
First, make sure you install Splendid UI.
npm install splendid-ui
Then import setCSSVar
into your project.
import { setCSSVar } from 'splendid-ui/utils'
setCSSVar
takes in two arguments.
element
is the element you want to get the CSS property from. This can be a selector string or an actual element.property
is the name of the CSS variable.value
is the value you want to set the CSS variable to.setCSSVar(element, property, value)
Here’s a quick guide on SetCSSVars
and setCSSVars
.
That’s all you need to know about setCSSVars
!