BemElement
BemElement<
T>(Base,config):T
Defined in: packages/webcomponents/src/bemElement.js:124
Mixin that makes a custom-element class a BEM component — the decorator-free form of bem, for projects that don’t compile TC39 decorators. 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), - observes
config.modifiersas attributes and recomputes on change.
class Card extends BemElement(HTMLElement, { element: 'card', modifiers: ['active'] }) {}customElements.define('bb-card', Card);// <bb-card active> → host class="card card--active"; descendants see block "card"Type Parameters
Section titled “Type Parameters”T extends (…args) => CustomElementLike
Parameters
Section titled “Parameters”T
The custom-element base class to extend (e.g. HTMLElement).
config
Section titled “config”Returns
Section titled “Returns”T
