Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 886 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 886 Bytes

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>