JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 493
  • Score
    100M100P100Q98099F
  • License MIT

Easy applied function to use with CSS modules and do not get lost in CSS classes

Package Exports

  • react-classnaming

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-classnaming) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-classnaming

Easy applied function to use with CSS modules and do not get lost in CSS classes

keywords test@ci coverage version license

Installation

npm install --save react-classnaming

Examples

import classNaming from "react-classnaming"

<div {...classNaming("class1", {class2, class3})}>
<div className={classNaming<string>({class4})}>
<div {...classNaming(classNames)({class1: bool1}, bool2 && class2)}>

Check the tests with detailed usage: ./src/index.test.ts

With create-react-application: ./recipes/cra/src/App.tsx

TS Generic for props

import type { ClassNames } from "react-classnaming"

ClassNames<true>

ClassNames<"class1"|"class2">

ClassNames<Props1, Props2>

ClassNames<true, "class1", Props, typeof Component1, typeof FunctionalComponent>