@lai9fox/bem

BEM class name generator

Generate BEM class names with methods such as block, element, and modifier, with TypeScript type checking.

// output
acme-button acme-button__icon acme-button--disabled

Install

$ npm i @lai9fox/bem

For component libraries and application UI

Set a class name prefix with namespace and combine classes based on component state. Works with JavaScript and TypeScript, with no UI framework dependency.

Documentation

Getting started — Create a button with an icon, add styles, and handle its disabled state.

API reference — Look up methods, types, configuration, and validation rules.

examples — Update button and icon classes as the download state changes.