A foundational part of your design system is how you choose to name styles and components. Giving your components reasonableâdare I say, consistentânames isnât just about developers. Itâs for your teammates who will be collaborating with you, and future designers who will need to work with these components without reading your mind.Â
Solid naming conventions make your designs easier to implement, your design systems easier to understand, and you a more collaborative designer. Inconsistent, context-specific names turn design systems into temporary solutions instead of a consistent, non-context-dependent design management tool.
(Want to make collaborating with developers even easier? Check out our Design System Manager.)
Letâs get into the best practices for naming conventions.
File naming convention best practices for styles and components
đ Tips for categories
Design systems have two categories: perceptual patterns and functional patterns. Every design system component fits into one of the above two major categories, and many incorporate elements from multiple categories.
Weâll be discussing perceptual patterns:
- Color
- Typography
- Sizing/spacing
- Imagery
While naming, try to focus on the elementâs category and role, but not its form.
A blue primary button in your system, for example, should be named button/primary/defaultâwithout any mention of its color. This naming structure ensures that your element evolves along with your system, so if the color of that primary button changes, you wonât have to update its name throughout your system and codebase components.
(Want to read more about design systems? Start with our comprehensive guide.)
Best practices 101
The non-negotiable important factors in naming a component are:
- Consistency
- Clarity
- Meaning
The goal of implementing conventions is to make the elementâs role in the design system obvious just from the nameâmeaning that, though iconsmallblue might make sense to you, itâs a disaster according to those three rules.Â
Good practices:
- Separating words with hyphens or forward slashesÂ
- Following an âorder of operationsâ type structure.Â
- Using lowercase letters only
Practices to avoid:
- Using numbers and symbols
- Describing colors or using font types
- Focusing on component role
When these are practices, component names will be understandable without context and readable without needing to be sounded out.
Some factors to keep in mind are:
- Category: mobile, inverse, ui
- Type: header, hero, title, subtitle, paragraph, button, input, caption
- Size: large, medium, small, default
- Alignment: left, center, right
(Put your naming convention knowledge to work in InVisionâs Design System Manager.)
Letâs get into category-specific guidelines:
đ Colors
- Structure: use/variation
- Examples:primary/default; tertiary/light
Usage examples:
- Good: brand/primary
- Bad: brand/green1
By describing colors using their role in the color hierarchy plus their differentiator, and not the color name, the color is clear without relying upon terms that could be misunderstood by someone unfamiliar with the style guide, or a colorblind collaborator.
âď¸ Text Styles
- Structure:category/type/size/style/alignment
- Examples:para/primary/left; mobile/para/large/bold/right; para/primary/italic/left; inverse; para/small/center
Usage examples:
- Good: para/primary/left
- Bad: para/caption/timesnewroman
Having a specific text style for a caption might be too limiting if itâs not one-of-a-kind in the system. Additionally, itâs best to not use the actual name of the text, as that is an element that might change with a rebrand and would then have to be updated across the board
đ¨ Layer Styles
- Structure:category/use/variation
- Examples:ui/input/default; fill/primary/hover; shadow/high
These names are based on clear and obvious layer styling elements and leave no guesswork for collaborators.
đ Components
- Structure:category/type/element/variation, or organism/molecule/atom/variation
- Examples:btn/primary/hover; nav/header/mobile/dark; cards/media-block/complex/web
Usage examples:
- Good: menu/dropdown/default
- Bad: menu_dropdown_1
By explaining the componentâs structure and functionality, these names provide context for the component without describing its appearance.
Thank you from your teammates
These simplified, streamlined, and standardized naming conventions might be less imaginative than what you had been doing to date, but theyâre much easier to work with. As your team and system evolve, youâll be grateful for the clarity in your naming conventionsâand the role they play in your design system.
Shayna is Managing Editor of InVision's design publication, Inside Design. She lives in Tel Aviv with two big dogs.