Design and Styling

Classes and States

33min

Classes are sets of custom styles for elements or widgets. They are needed in order to simplify the process of styling the site.

You may change the design of identical elements by styling one and saving the setting in a class. After that, you may apply the saved class to other similar elements. You may apply any number of classes containing the desired styles to an element.

You may manage classes on the Design tab in the right panel of the Design Editor.

System styles

Each element has default styles. For example, the size or Auto Layout settings. Styles are assigned to an element automatically when it is added to the Canvas. These are unchangeable system styles. However, you may override the element's styles.

Document image

Document image


If you make changes to styles on the Design tab, they will be unique and applied only to the selected element. These are unique element styles.

If you want to add the same styles to several elements, create a class with the necessary settings.

Unique styles

An element may have no assigned classes, in which case the styles will be available on the Design tab. These are unique styles. To set such styles, you do not need to create a class, just select the desired settings on the Design tab.

This styling method is suitable if the element styles do not have to be reused. For example, this way you can add a font for the entire project by applying it to the Root layer.

Document image


Unique styles are highlighted by the color of the breakpoint for which they were added.

Custom classes

 With custom classes you may save style settings to reuse them later. Once you've created a class for an element, you may customize the styles you want. Then, assign this class to other elements in the project that should have similar styles.

The custom class will be highlighted with the color of the breakpoint for which it was created.

You may assign several classes to an element, thereby defining sets of different styles. For example, you may create button-big and button-small classes with size and typographics for buttons, and button-success and button-info classes that define button functions. This way you may combine these classes, applying them to different buttons, to create the desired interface.

Creating Custom Classes

To add a custom class, click “+” in Classes.

Document image


By default, a class is created with the name class. You may change it. To do this, enter the desired name in the block that opens. For example, let's create the button-color class, which will be responsible for the color of the button.

Document image


Name the class using Latin letters. No numbers in the beginning of the name or spaces are allowed.

To save the class, press the Enter. The class appears in the element's class list. Now you may set styles for it.

Adding Styles to the Custom Class

When you create a class, it is added without any styles specified. You may add styles to that class. Let's add a background for the created button-color class.

To add the desired styles:

  • Click “+” next to the desired property. Styles are added separately for each selected property;
Document image

  • Set the desired properties. Add Background color.
Document image


Add style properties one by one.

Assigning the created class to elements

You may assign any class that has already been added to the project to an element. For example, set the background color for the blocklist. To do this, select an element on the Canvas and:

  • click  “+” in Classes;
  • start entering the name of the desired background-color class — a list of project classes that match the one you are looking for will open below;
Document image

  • click the desired class, it will be assigned to the element and displayed in the list of its classes. You will also see how many classes are assigned to the element.
Document image


The same class can be reused not only for identical elements, but also to set styles for different elements.

Using Custom Classes

 You may do the following with Custom Classes:

  • Rename;

You may assign a name to the class that describes its purpose as accurately and clearly as possible. For example, the border-radius class will be responsible for rounding the corners of elements.

Use Latin letters to name the class. No numbers in the beginning of the name or spaces are allowed.

  • Duplicate

You may create a copy of the class containing all the styles applied to it, and then change some of the styles to create modifications. For example, the newly created button-color-contact class can be responsible for the color of buttons that are needed to collect contact data from site visitors.

  • Duplicate and replace

This way you may simultaneously copy the class and replace the class of the selected element.

  • Delete from the element

This is used to delete styles from the selected element. Other elements with the same class will [reserve their settings.

  • Delete from the project

If you remove a class from a project, all elements that were assigned that class will have their custom styles removed.

To use the previously created class:

  • click Applied classes to open the list;
  • hover over the desired class and click Edit;
Document image

  • open the context menu next to the class name by clicking the three dots;
Document image

  • select the desired action in the list.

Changing Class Styles

To change the existing class styles, click Edit in the list of classes or class name in the style panel. The class styles editing menu will open.

Document image

Document image


Follow the instructions above to configure the desired style settings. This way, you may consistently define styles for all classes of an element, switching between them.

Changing the styles of the class that is assigned to multiple project elements automatically affects the styles of all of those elements. You may change the styles of the class assigned to any of the elements. These changes will automatically be applied to the remaining elements.

For example, you need to change the background color of the buttons that allow the user to leave a request on the site.

  • Select one of the buttons on the Canvas, add a new class in Classes or select the already created button-color class.
Document image

  • Assign the background color to the class, for example, green.
Document image

  • Assign the resulting button-color class to other similar project elements.

Ready! The selected background will be applied to all the buttons that help the user leave a request on the site.

By changing one element, you will change all the necessary elements at once. This simplifies the process of website styling.

Prioritizing classes

If you have assigned several classes to an element, the styles of all of these classes will be applied to it. If the same style parameter is specified in two or more classes, although with different values (for example, the background color is set to green in one class, and blue in the other), then the class that is closest to the beginning of the list will take precedence.

For example, the button has rounded corners and background color. The following classes are used: button-color-green (responsible for the green background color), button-color-blue (responsible for the blue background color) and button-border (responsible for the rounded corners).

Since the button-color classes are responsible for the same parameter, button-color-blue will have priority — it is closer to the beginning of the list. The background color of the button will be blue.

button-border is the only class responsible for the rounded corners, so these styles will be applied.

Document image


If an element has more than one class with the same styles, the priority one will be available in the styles panel.

You can see the rest by clicking the button with a number next to the class name.

Document image


States

You may style states individually for each element or custom class. To do this, click “+” next to the list of states and select the desired value.

States for Unique Styles

You may add state for unique elements on the Design tab. These will be states of unique styles.

To add a state, open the list in the State menu and add the one you need.

Document image


To style different states for an element with unique classes, select states from the list one at a time.

For example, let's change the transparency of an element in the “on hover” state.

Document image


States for Custom Classes

To add a state for an element that has a custom class, open the class editing settings. For example, let's add the “on hover” state for the button-color-green class.

Do the following:

  • click on Applied classes and go to class editing mode.
Document image


The class applied to the element will be highlighted in blue.

  • select the required state from the list.
Document image


If the state has already been added, it will be available for selection. To edit it, click on the name of the state.

Document image

  • add the desired styles. For example, background color transparency.
Document image


To add different states for a custom class, select states from the list one by one.

Element styles for one state in different display modes (breakpoints)

If you want to define different styles of a custom class in the same state, but for different breakpoints, create a class for the desired state with a default breakpoint (PC). After this, you may add states for the remaining breakpoints.

Select the one you need from the list of classes by clicking Applied classes and go to the  editing mode. Add the desired state according to the instructions above. For example, let's add a selector for the "on hover" state.

Document image


To add a state for a different breakpoint, switch to it. For example, let's switch to the Tablet breakpoint. To do this, select the breakpoint in the center of the top panel. This will take you to styling for the Tablet breakpoint. Set the desired styles.

Document image


Ready! The custom class color will be highlighted with the breakpoint color for the selected state.

Document image


In the same way, you may add breakpoint styles for unique elements, the styles of which are available on the Design tab.