Customization

Customizing Spacing

Spacing is a fundamental aspect of design in ZoboUI, affecting everything from layout to the rhythm of your UI. The spacing and negativeSpacing fields in the ThemeConfig asset allow you to define these values globally for your project.

The spacing values are used by a number of utilities in your project, and save time by allowing you to use a consistent spacing scale throughout your UI without having to define each value individually for each utility.

Why Both Positive and Negative Spacing?

Positive spacing is used to create padding, margins, and insets, and is often used to separate elements from each other. Negative spacing, on the other hand, can be used to pull elements closer together or overlap them. Having both allows for a more comprehensive design system that can handle a wide range of layout scenarios.

Default Spacing Scale

By default, ZoboUI includes a spacing scale inspired by Tailwind CSS. Since Unity does not support rem units, all values are in px for absolute sizing.

Here are the default spacing values:

KeyValue
00px
14px
28px
312px
416px
520px
624px
728px
832px
936px
1040px
1144px
1248px
1456px
1664px
2080px
2496px
28112px
32128px
36144px
40160px
44176px
48192px
52208px
56224px
60240px
64256px
72288px
80320px
96384px
px1px
0point52px
1point56px
2point510px
3point514px

Similarly, here are some default negative spacing values, which are prefixed with minus-:

KeyValue
minus-0-0px
minus-1-4px
minus-2-8px
minus-3-12px
minus-4-16px
minus-5-20px
minus-6-24px
minus-7-28px
minus-8-32px
minus-9-36px
minus-10-40px
minus-11-44px
minus-12-48px
minus-14-56px
minus-16-64px
minus-20-80px
minus-24-96px
minus-28-112px
minus-32-128px
minus-36-144px
minus-40-160px
minus-44-176px
minus-48-192px
minus-52-208px
minus-56-224px
minus-60-240px
minus-64-256px
minus-72-288px
minus-80-320px
minus-96-384px
minus-px-1px
minus-0point5-2px
minus-1point5-6px
minus-2point5-10px
minus-3point5-14px

Customizing Your Spacing

You can customize your global spacing and sizing scale within the Theme Config asset. Under the Core section, you will find the Spacing and Negative Spacing fields where you can add or adjust the spacing values as needed.


With ZoboUI's spacing system, you have the flexibility to define a consistent and intuitive spacing scale, making your UI design cohesive and pixel-perfect.

Previous
Colors