bem
bem<
T>(config): (value,context) =>T
Defined in: lit/src/bem.js:85
Standard (TC39) class decorator that makes a custom element a BEM component —
the Lit / web-components analog of @bem-broom/react’s withBem. It:
- reads the block from context (an ancestor’s element, or none at the root),
- applies the computed BEM class(es) to the host element,
- provides
config.elementas the block for descendants (re-rooting), - recomputes on modifier-property or context change (on Lit hosts).
Apply it below @customElement so the element is defined with the wrapped
class:
@customElement('bb-card')@bem({ element: 'card', modifiers: ['active'] })class Card extends LitElement { … }Type Parameters
Section titled “Type Parameters”T extends (…args) => HTMLElement
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”(value, context) => T
