New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vanilla-classnames

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-classnames

Better classnames utility for vanilla-extract

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

vanilla-classnames

NPM version NPM Weekly Downloads License

vanilla-classnames (short to vcn) is better version of classnames for vanilla-extract.

Installation

yarn add vanilla-classnames

npm install vanilla-classnames

Usage

There is codesandbox example

// styles.css.ts
import { style, composeStyles } from '@vanilla-extract/css'
import { vcn } from 'vanilla-classnames'

export const item = vcn(style({
  //first, some base styles (it can be omitted)
  background: 'blue',
}), {
  //and then, dynamic variants
  active: style({
    background: 'green',
  }),
  
  //if pass array from two classes, then
  disabled: [
    //first will be applied on truthy condition
    style({
      background: 'none',
      color: 'gray',
    }),
    //and second - for falsy or omitted condition
    style({
      cursor: 'pointer',
    }),
  ],
})
import React from 'react'
import * as S from './styles.css'

const SomeItem: React.FC<{active?: boolean, disabled?: boolean}> = ({active, disabled}) => <>
  <div className={S.item({active, disabled})}>
    Styled div!
  </div>
</>

That's all, folks! Of course, item function will suggest variants names in typescript.

Keywords

css

FAQs

Package last updated on 11 May 2021

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