You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a situation where we have a selection__control element that lives within a selection block. This class does not create much style on the element it applies to, but rather creates styles for ::before and ::after to create an appearance of a radio or checkbox control (which are applied with a modifier, i.e. selection__control--checkbox). We have another class, which we're undecided about naming. We do not know if it should be an element, block, or modifier. the class, selection__tile, can be used in tandem with the selection__control to create an appearance of a tile around the control. Since the selection__control primarily targets befores & afters it can be composed really easily with selection__tile since tile affects the element it is styling. This means selection__tile can also be used outside of the selection__control use case. Meanwhile, the use cases for both elements can be really similar. On one hand, selection__tile can be seen as a modifier of the control when used with the control (selection__control--tile). On the other hand, when used outside of the control, it can be seen as a block.
When it is unclear if a class should be a block, element, or modifier since it can be both, what is the recommendation? At this point, we're considering just calling it a modifier, and not suggesting to use the selection__control--tile class outside of the control use case, but it feels like an artificial limitation do to the nature of how we conceive of these things and name them.
This discussion was converted from issue #203 on September 12, 2022 19:29.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Note: we use
--
to denote a modifierWe have a situation where we have a
selection__control
element that lives within aselection
block. This class does not create much style on the element it applies to, but rather creates styles for::before
and::after
to create an appearance of a radio or checkbox control (which are applied with a modifier, i.e.selection__control--checkbox
). We have another class, which we're undecided about naming. We do not know if it should be an element, block, or modifier. the class,selection__tile
, can be used in tandem with theselection__control
to create an appearance of a tile around the control. Since theselection__control
primarily targets befores & afters it can be composed really easily withselection__tile
since tile affects the element it is styling. This meansselection__tile
can also be used outside of theselection__control
use case. Meanwhile, the use cases for both elements can be really similar. On one hand,selection__tile
can be seen as a modifier of the control when used with the control (selection__control--tile
). On the other hand, when used outside of the control, it can be seen as a block.When it is unclear if a class should be a block, element, or modifier since it can be both, what is the recommendation? At this point, we're considering just calling it a modifier, and not suggesting to use the
selection__control--tile
class outside of the control use case, but it feels like an artificial limitation do to the nature of how we conceive of these things and name them.Beta Was this translation helpful? Give feedback.
All reactions