1.2.0 • Published 7 years ago
create-bem v1.2.0
Create BEM
Provides a simple API for generating BEM like class names.
Installation
Install using the NPM:
npm install -S create-bem
Usage Example
A simple use case in a ReactJS component:
import React from 'react';
import createBEM from 'create-bem';
let bem = createBEM('Modal');
const Modal = ({ children, title, open }) => (
<div className={ bem.md('open', open) }>
<div className={ bem.el('heading').md('warning') }>{ title }</div>
<div className={ bem.el('body') }>{ children }</div>
</div>
);
And this component will get those CSS class names, according to the properties:
Modal
Modal Modal--open
Modal__heading Modal__heading--warning
Modal__body
License
MIT