@garystorey/cssclass
TypeScript icon, indicating that this package has built-in type declarations

1.2.5 • Public • Published

cssclass

A small dependency-free utility to combine css classes written in TypeScript.

Version Size License

Leywords

Installation

You can install either with npm or yarn:

npm install @garystorey/cssclass

yarn add @garystorey/cssclass

Usage

Example in JavaScript:

import cssclass from '@garystorey/cssclass'

const value = 1
const classes = cssclass(`default`, {
  notadded: value === 0,
  added: value === 1,
})
console.log(classes)
// "default added"

Since cssclass is written in TypeScript, it includes its own types.

import { cssclass, CSSClassObject } from '@garystorey/cssclass'

const classObject: CSSClassObject = {
  notadded: value === 0,
  added: value === 1,
}

const value: number = 1
const classes = cssclass('default', classObject)
console.log(classes)
// "default added"

You can see it in action on this CodeSandbox.

Package Sidebar

Install

npm i @garystorey/cssclass

Weekly Downloads

2

Version

1.2.5

License

MIT

Unpacked Size

8.5 kB

Total Files

8

Last publish

Collaborators

  • garystorey