Skip to content

A react utility function that generates prefixed classnames

License

Notifications You must be signed in to change notification settings

Enrise/BemClassNames

Repository files navigation

Build Status

BemClassNames

An utility function for writing simple prefixed classnames.

It is just a wrapper around classnames so you can use every feature from that library.

How to install

npm install @enrise/bemclassnames

How to use

The following component:

import React from "react";
import bemClassNames from "@enrise/bemclassnames";

const cn = bemClassNames("Main");

const Main = () => (
  <div classnames={cn()}>
    <h1 classNames={cn("title")}>The title</h1>
    <div classNames={cn("content")}>The content</div>
  </div>
);

export default Main;

Will result in:

<div class="Main">
    <h1 class="Main-title">The title</h1>
    <div class="Main-content">The content</div>
</div>

About

A react utility function that generates prefixed classnames

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published