A TypeScript utility for generating BEM modifier class names from component props.
With pnpm
pnpm add @rhapsodic/bem-classnamesOr, with npm
npm install @rhapsodic/bem-classnamesOr, with yarn
yarn add @rhapsodic/bem-classnamesOr, with bun
bun add @rhapsodic/bem-classnamesimport { bmc, flag } from '@rhapsodic/bem-classnames';
const buttonClasses = bmc('button', {
size: true,
variant: true,
isDisabled: flag('state', 'disabled'),
});
const classes = buttonClasses({
size: 'large',
variant: 'primary',
isDisabled: true,
});
// ['button', 'button_size_large', 'button_variant_primary', 'button_state_disabled']Learn more on the Documentation
This repository includes provider-agnostic agent skills in skills.
Install them directly from GitHub:
npx skills add rhapsodic-dev/bem-classnames --allThey can also be installed as a package:
pnpm add -D @rhapsodic/bem-classnames-skills skills-npmAdd skills-npm to the consuming project's prepare script:
{
"scripts": {
"prepare": "skills-npm"
}
}