Components and utilities for the modern web
Javascript Utilities


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!

Like what you're seeing?

I'm on a quest to make web development extremely easy — by building components and utilities that will help all of us build better apps at a much faster pace.

I'd like to send you an update when I release something new in Splendid UI. If you want to be updated, please leave your email address below.

Powered by Buttondown