Codux Help Center
Browse our articles to find the answers you need
Using classNames in Codux
The
conditionalClassnamesConfig
key specifies options for using the classNames utility library by JedWatson in Codux.conditionalClassnamesConfig
- Description: Options for using the
classNames
utility library, including path toclassNames
module, and target export. - Type: Object {}
- Properties:
classnamesPath
,classnamesTarget
How to add to codux.config.json
When set, Codux will display class names created by the classNames utility library in the UI, and write new class names following the library's convention.
Property: classnamesPath (string)
This is the path to the classNames module (
"classnames"
, by default).Property: classnamesTarget (string)
This property specifies the target export of the module (
"default"
, or the name of the named export by default).Example 1 - Named Export
1 2 3 4 5 6
{ "conditionalClassnamesConfig": { "classnamesPath": "classnames/foo", "classnamesTarget": "cx" } }
1 2
// import statement import { cx } from "classnames/foo";
Example 2 - Default Export
1 2 3 4 5 6
{ "conditionalClassnamesConfig": { "classnamesPath": "myClassnamesFork/bar", "classnamesTarget": "default" } }
1 2
// import statement import cx from "myClassnamesFork/bar";
Was this article helpful?