Skip to content

Getting started

bem-broom builds and parses BEM class names from plain JavaScript objects. It’s a small monorepo:

Terminal window
# Core only
npm install @bem-broom/core
# React helpers (core is a dependency; react is a peer)
npm install @bem-broom/react @bem-broom/core react
# Custom-element helpers (no framework)
npm install @bem-broom/webcomponents @bem-broom/core
# Lit helpers (lit is a peer)
npm install @bem-broom/lit @bem-broom/core lit
import { bem } from '@bem-broom/core';
bem({ block: 'card', modifiers: { block: { active: true } } });
// → ['card', 'card--active']

From here: