Class system

Class system

This document explains the class system in Mosaic. It includes guidance on creating, organizing, and managing classes, as well as using the Class manager. You'll also learn how to work with states, breakpoints, and customize styles for different devices.

The class system in Mosaic offers an efficient way to style multiple elements effectively, building upon CSS fundamentals. Leveraging this class system can significantly speed up the editing process, making it an essential feature for a seamless design experience. It consists of element classes, element subclasses, utility classes, and utility subclasses.

Each element is designated an element class, which establishes its initial appearance. Some elements can have multiple element classes to choose from, but only one element class can be selected at a time, allowing them to achieve different looks. Element classes can be further refined using element subclasses, allowing for detailed customization.

Mosaic Button element class settings showing primary and secondary subclasses as styling options.

For example, the Button element class might have primary and secondary as element subclasses. These element subclasses can, in turn, be extended with additional element subclasses, enriching the styling options available.

Mosaic class system interface showing element subclasses extended with additional subclasses.

Using element classes and element subclasses is recommended because they maintain a hierarchical structure that is directly linked to the elements. On the other hand, utility classes, including their utility subclasses, are universal and can be applied to any element without restrictions. This flexibility makes utility classes a versatile tool, though they operate outside the hierarchical system of element and element subclasses.

Working with classes

Classes can be selected in the Editor on the active element’s style panel. These classes are connected to the style settings of the given element. As you can see below, state properties are part of them too.

Classes section highlighted in Mosaic’s Style tab, showing how style classes are connected to the selected element’s styling

Every styleable element has two default classes: an element class and a custom class, and any number of element subclasses, utility classes, and utility subclasses. If you want to edit the current element only, use the custom class. If you want to edit multiple elements together, use one of the additional classes.

  • Element class: All elements with the same element class share their styles.
  • Element subclasses: Element subclasses have the ability to define new classes based on element classes. They are optional.
  • Utility classes: Utility classes provide a way to apply consistent styles across various elements on your website. They are optional as well.
  • Utility subclasses: They are a way to fine-tune your styles by building on the utility classes you already have. They can provide extra detailed options that are fully optional.
  • Custom class: Unique to each element, applying specific styles only to that element.

Create, add, or select

Within Mosaic you can only create element sub, utility, and utility subclasses, but not element classes. They are an integral part of the system.

1. Create element sub or utility classes

Click the + button on the right side of the class list. It gives you the option to create either of them.

Popup window in Mosaic showing tabs to create new element sub-classes or utility classes after clicking the plus button in the class list

2. Create a completely new class

Write down its name and press Enter. If you want to select an existing class, you can find a list of your classes under the search/create field.

Class creation field in Mosaic highlighted

3. Add a utility subclass to an existing utility class

Go to the Utility tab and pick the class you want to add a new one to. Once selected, this class will appear in your class list, allowing you to add a utility subclass using the create/search field.

Utility tab highlighted in Mosaic’s class creation interface, allowing users to select a utility class and add a subclass via the search field

4. Select element class

In some elements, you can choose from predefined element classes. You can do this in two ways:

  • Use the dropdown on the right-hand side panel.
Mosaic editor showing the right-hand side panel's classes section with a dropdown menu for selecting element classes.
  • Select directly on the Canvas.
Mosaic editor showing how to select an element class directly on the Canvas

Class selector

In the Toolbar, you can easily choose element, element sub, utility, and utility subclasses for your elements, making the styling process more efficient.

Class selector in Mosaic’s Toolbar showing dropdown for selecting classes

You can find the same menu in the Class manager. Simply use the dropdown menu of your classes to access all their available classes located within their element, element sub, or utility class menu points.

Class manager in Mosaic showing dropdown menu with access to classes

Actions

Each class has an Actions list containing options specific to that class type. These are the possible options you can find:

  • Duplicate: Create a new class with the style settings of the current class.
  • Rename: Rename the current class.
  • Assign as default: By default, when you select an element, the Custom class will be selected. You can change that, by marking a different class as default.
  • CSS Class: What we call “classes” in Mosaic are not actual CSS classes, they are just names used within our system. If you would like to add a CSS class to the HTML code of elements using the current Mosaic class, use this option.
  • Copy style: Copy the style settings of the selected class.
  • Paste style: Paste the style settings to the selected class.
Dropdown in Mosaic’s Class manager displaying the Actions list with options for the selected class type

Best practices

When you are creating classes, we suggest keeping things clean and well-organized. Here are some tips to help you maintain a structured approach.

Add meaningful names

Name your classes in a way that makes them easy to recognize. Instead of generic names like “text a” and “text b”, opt for descriptive names such as “description” and “title”.

Element subclasses first

Start with element subclasses as they often have a strong connection to the element you’re working on. It helps maintain a logical hierarchy.

Don’t over-specify element subclasses

Try not to get too specific with element subclasses. Instead, use element sub-subclasses to create variations within an element subclass. For instance, a text element’s first element subclass could represent its size, while element sub-subclasses could stand for different font weights.

Utility classes for common styles

Create utility classes for styles that are commonly used across various elements. For example, a consistent border radius and box shadow could be applied to both image and button elements.

Use the Style guide

Take advantage of the Style guide feature. It allows you to create a visual representation of each class, making it easy to check and modify them.

Strength in styling

Your class types are listed in separate slots, and any extra utility class will show up on additional slots. This vertical setup sets the style hierarchy from top to bottom. Plus, for all slots, except for custom classes, the order from left to right also matters, so your styles are affected by both the horizontal and vertical arrangement of your classes.

Let’s break this down with an example. A text element has all possible classes: an element class, an element subclass, a utility class, a utility subclass, and a custom class. Let’s set the following styles.

Example in Mosaic’s Class manager showing a text element assigned with all types of classes

1. Set the element class

  • Text: Red font color
  • M: No specified font color
  • Box shadow: No specified font color
  • S: No specified font color
  • Custom: No specified font color

→ This way your text will be red.

2. Style of the element subclass

  • Text: Red font color
  • M: Blue font color
  • Box shadow: No specified font color
  • S: No specified font color
  • Custom: No specified font color

→ The text will become blue.

3. Add color to the utility class

  • Text: Red font color
  • M: Blue font color
  • Box shadow: Green font color
  • S: No specified font color
  • Custom: No specified font color

→ The text will have a green color.

4. Set a color for the utility subclass

  • Text: Red font color
  • M: Blue font color
  • Box shadow: Green font color
  • S: Yellow font color
  • Custom: No specified font color

→ The text will have a yellow font color.

5. Use the custom class

  • Text: Red font color
  • M: Blue font color
  • Box shadow: Green font color
  • S: Yellow font color
  • Custom: Violet font color

→ You will end up with a violet text.

Breakpoint selector

You can edit the style settings device specifically. To help this process, you can find the same breakpoints in the Class manager as you would in the Toolbar. Each breakpoint shows the available hover states.

Breakpoint selector highlighted in Mosaic’s Class manager, showing device-specific styling options and corresponding hover states

State selector

Customizing the appearance of buttons and links when you hover over them is a common practice. In our Editor, you can easily define distinct styles for these interactive states.

To explore more styling options, look for the Hover and other states under the class list. This allows you to enhance the visual experience of your buttons and links based on different user interactions.

State selector dropdown in Mosaic showing hover and other interactive states for customizing element appearance based on user interactions

You can set these states for specific devices for a more customized user interaction.

Device-specific dropdown in Mosaic’s State selector allowing styling of interactive states like hover across different screen sizes

Custom states

You can use the + sign to define extra states, this allows you to create more complex styling scenarios.

Plus button highlighted in Mosaic’s State selector for adding custom states

In the selector field, the & sign represents your element’s class, like in Sass or SCSS. For instance, define an after pseudo-element as follows.

Custom state popup in Mosaic with selector field using '&' symbol to define pseudo-elements like ::after for targeted styling

Unlock your creativity by combining states. Imagine you have a <div> element containing various elements, including links (<a> elements). To create an engaging effect, let’s explore how to simultaneously change the styles of all links within the <div> when hovering over it.

  1. Define the hover state for the <div> element using &:hover
  2. Adding a after &:hover specifies that the styles apply to all <a> elements inside the hovered <div>
Example in Mosaic showing combined state selector with &:hover a to style all links inside a <div> when it is hovered

Styles

Each state is directly linked to the style settings listed below it, which determine its appearance and behavior. These settings play a crucial role in defining the overall design and functionality. You can learn more about the style settings here.

Class manager

Effortlessly manage and organize your classes through the Class manager. Use it to easily handle tasks such as deleting, renaming, and performing other functions with your classes. You can access it in one of two ways.

1. From the class list

  • Click on the Add button.
  • In the popup, click on the cog icon to manage subclasses, or you can find the same icon under the Utility tab to manage utility classes.
Cog icon highlighted in Mosaic’s class creation popup, used to access the Class manager for managing subclasses or utility classes

2. From the Top panel

  • Alternatively, you can access the Class manager through the Top panel‘s settings.
Cog icon highlighted in Mosaic’s Top panel settings, offering an alternate way to access the Class manager for managing styles

Once in the Class manager, you gain the power to:

  • Reset: Restore a class to its default settings.
  • Duplicate: Create an exact copy of a class.
  • Rename: Give your classes more meaningful or updated names.
  • Favored elements: Mark specific classes as favorites for quicker access and organization.
  • CSS Class: Assign or modify the CSS class associated with it to customize its styling.
  • Delete: Remove classes that are no longer needed.
  • Exclude: Hide specific classes from search results.
Class manager interface in Mosaic showing options for styling control

FAQ

Last updated: September 16, 2025

Still have more questions? Let us help!

We use cookies to improve your experience, analyze traffic, and personalize content. By clicking "Accept all" you agree to storing them on your device. Read our privacy policy.

Accept all
Reject all