Splendid UI
Components and utilities for the modern web
-->
getCSSVar
lets you get the value of a CSS variable from an element.
First, make sure you install Splendid UI.
npm install splendid-ui
Then import GetCSSVar
into your project.
import { getCSSVar } from 'splendid-ui/utils'
getCSSVar
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.const value = getCSSVar(element, property)
Here’s a quick guide on getCSSVars
and setCSSVars
.
That’s all you need to know about getCSSVars
!