Components and utilities for the modern web
Javascript Utilities

SetCSSVar

setCSSVar lets you set the value of a CSS variable.

Installation

First, make sure you install Splendid UI.

npm install splendid-ui

Then import setCSSVar into your project.

import { setCSSVar } from 'splendid-ui/utils'

Usage

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)

Guide

Here’s a quick guide on SetCSSVars and setCSSVars.

That’s all you need to know about setCSSVars!

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