Socket
Socket
Sign inDemoInstall

@microsoft/arbutus.use-css-vars

Package Overview
Dependencies
14
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

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
6
decreased by-71.43%
Maintainers
2
Created
Weekly downloads
 

Readme

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

Last updated on 29 Nov 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc