React BEM Components
Super simple components to create BEM styled component.
Components
React BEM comes with multiple built in components
- Wrapper
- Title
- Text
- Button
- Link
- Image
Usage
Each component has named props to aid in building your desired BEM structure
; { console; } { const block = 'my-component'; ; } /**rendering this component outputs: <div class="my-component my-component--default"> <h2 class="my-component__title title title--default">Cool Title</h2> <p class="my-component__text text text--large">Some large text</p> <button class="my-component__btn btn btn--wide btn--outline btn--wave-hover">Click me</button></div> */
Props
Each BEM props comes with the same basic prop types:
const propTypes = // the element tag e.g. div, h1, p, etc tag: PropTypesstring block: PropTypesstring element: PropTypesstringisRequired modifier: PropTypesstring // for elements with multiple modifiers required modifiers: PropTypes // any non bem related classes extraClasses: PropTypesstring id: PropTypesstring // data-attributes attributes: PropTypesobject;