bem

BEM class names: block--hide or just hide?


When using BEM naming conventions, should show and hide classes have the block as part of the name?

So if I have div.block-class and I want to hide it, should it be div.block-class.hide or div.block-class.block-class--hide ?


Solution

  • The second option is correct unless you consider hide as a stand alone block which you mix to block-class (refer to https://en.bem.info/faq/#how-do-i-make-global-modifiers-for-blocks).