Socket
Socket
Sign inDemoInstall

@microsoft/arbutus.use-css-vars

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/arbutus.use-css-vars

useCSSVars takes an object of theme values, generates CSS variables from them, and injects them into the document.


Version published
Weekly downloads
3
decreased by-40%
Maintainers
1
Weekly downloads
 
Created
Source

Hook: useCSSVars

useCSSVars takes an object of theme values, generates CSS variables from them, and injects them into the document.

Get Started

npm i @microsoft/arbutus.use-css-vars
import { useCSSVars } from '@microsoft/arbutus.use-css-vars';

Usage

  • theme An object of theme values. An object can be nested (e.g. color.button.primary: #fff will translate to --color-button-primary: #fff).
  • prefix A string to prefix all CSS variables with. This is an optional parameter, but it is recommended to use it to avoid CSS variable collisions.
const theme = {
  color: {
    button: {
      primary: '#fff',
      secondary: '#000',
    }
  }
}

const MyAppShell = () => {
  // Injects CSS variables into the document.
  useCSSVars({ theme, prefix: 'MY_APP' });

  return (<div>...</div>);
}

FAQs

Package last updated on 26 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc