Go-to class names
Naming things is hard, but when I create components I usually go for the same class names.
Here are some of the names I use for different parts of a website.
PS: I use BEM as a naming convention, so bear in mind that these names are also used as elements, not only as blocks.
Global components
headerfootersite-headersite-footerbreadcrumbssiteapp
Navigation
main-navnavnavigationmenumenu-togglemain-menumobile-menudropdown-menusome-menu(social media)site-navtool-menu
As long as the navigation component is some kind of menu I like to suffix it with menu
Links and buttons
I like to differentiate between buttons (clickable element that performs an action) and links that looks like buttons (anchors styled as a box).
[type]-link(e.g. inline-text-link, more-link, navigation-link)[type]-button(e.g. save-button, cancel-button, menu-button)link-buttonbuttonbtn(I will try not to use this anymore, I'm not a fan of shortening already short words)toggle(for buttons that turn something on/off, opens/closes etc.)[type]-toggle(e.g. menu-toggle)
Components
For hidden elements with open/close mechanisms:
accordionpaneldialogmodaliceberg(e.g. accordions that show some of the content with a "show more"-button. You know, like the "tip of an iceberg")
For collections, e.g. containing posts, products, projects etc.:
[item-type]-list[item-type]-cards[item-type]-grid(I'm a bit careful with using the word "grid", as it may be weird to use on a component that may not look like a grid on all screens, for instance a collection of products that looks like a grid on large screens, but like a vertical list on smaller screens)projectspostsarticles
For items in a list or collection, e.g. posts, products, projects etc.:
[item-type]-teaser[item-type]-preview[item-type]-card
Other components:
badgetagavatarlogotabstabtable
Forms and inputs
fieldradioscheckboxesdropdownselect[type-of-form]-form(e.g. contact-form, checkout-form)
Text and content
These are usually just part of components and rarely blocks themselves.
headersubtitletitleeyebrow(a small line of text that is placed above a title or heading. It looks like an eyebrow, doesn't it?)taglinelabelbodycontentintroleadingfooter
Layout
Most layouts or templates contain one-offs; sections and parts that are not used much elsewhere. In those cases I tend to prefix the class with both l- and the name of the template, like so:
l-frontpagel-subpagel-landingpagel-archive
I use these as blocks and apply parts as elements, e.g.:
l-frontpage__hero-sectionl-subpage__breadcrumbs(a wrapper for breadcrumbs on the layout used for subpages)l-subpage__mainl-landingpage__banner
And so on.
Utilities
I usually create some utility classes that I can use as supplements to other components, that I prefix with u-. I've written more about it here. These vary from project to project, but one I always use is this:
u-visually-hidden(as class that hides something from view, but keeps it in the DOM for screen readers and search engines to access)