Layout and spacing

Layout and spacing create structure, improve readability, and establish visual consistency. The Sharjah Design System provides a flexible spacing framework that helps teams build balanced and responsive interfaces.

Layout

A well-structured layout system ensures consistency, improves readability, and creates predictable user experiences. Our layout foundation includes responsive grids, spacing scales, breakpoints, and container patterns that work across all government digital services.

Responsive design

There are 5 breakpoints by default, inspired by common screen resolutions.

Responsive breakpoints
Breakpoint Minimum width Properties
sm 640 px @media (min-width:640px) { ... }
md 768 px @media (min-width:768px) { ... }
lg 1024 px @media (min-width:1024px) { ... }
xl 1280 px @media (min-width:1280px) { ... }
2xl 1536 px @media (min-width:1536px) { ... }

Learn more about Responsive Design on the documentation of Tailwind CSS

It is essential to understand responsive design and the available breakpoints as the variations that can be used to control content. Knowing the breakpoints of your layout will help you understand the grid better. The grid is reactive to these breakpoints, which will allow you to adjust columns according to the breakpoints.

The approach to mobile responsive design

Since the dawn of smartphones, creating websites that can adapt to the screen size of a device has become a key factor in the design and development of websites.

It was as early as 1994 when the concept of media queries was first proposed. In the year 2000, W3C started work on media queries and also on another scheme for supporting various devices. [read more]. But it was the breakthrough in the use of smartphones and touch-based devices that accelerated the addition of media queries and in 2012, it was finally introduced as part of CSS.

Today, we cannot imagine building a website without media queries that react to device size. In 2020, Google announced that mobile-first indexing would be the primary way for Google Search to index websites for search results.

Why is this important?

When designing websites, the approach to mobile and device width is a very important factor. The UAE design system takes the approach of a mobile-first approach in its CSS setup. This means that when you design and program the frontend of your website, you must first consider the layout for a mobile device and gradually add elemental changes to how it will adapt to larger screen sizes.

Grid

The grid system has been part of website design and development for a very long time. Using a grid provides designers and developers with the ability to align content vertically and horizontally.

However, it continues to evolve with the changes and trends in design.

The design system adopts the Tailwind width approach. In this sense, it does not:

  • Use a fixed width per column but rather calculates width dynamically in percentage.
  • Emphasis the use of a gap (i.e. space or gutter) between columns

The following is a visualisations of the grid system applied using all the possible classes available in the design system, adapted from TailwindCSS that allows you to control the columns of your grid.

w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-2/6 33.3333%
w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-3/6 50%
w-1/6 16.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-4/6 66.6667%
w-1/6 16.6667%
w-1/6 16.6667%
w-5/6 83.3333%
w-1/6 16.6667%
w-1/5 20%
w-1/5 20%
w-1/5 20%
w-1/5 20%
w-1/5 20%
w-2/5 40%
w-1/5 20%
w-1/5 20%
w-1/5 20%
w-3/5 60%
w-1/5 20%
w-1/5 20%
w-4/5 80%
w-1/5 20%
w-1/4 25%
w-1/4 25%
w-1/4 25%
w-1/4 25%
w-3/4 75%
w-1/4 25%
w-1/2 50%
w-1/2 50%
w-1/3 33.3333%
w-1/3 33.3333%
w-1/3 33.3333%
w-2/3 66.6667%
w-1/2 33.3333%
w-full 100%

12-column grid

1
2
3
4
5
6
7
8
9
10
11
12

Two equal columns

6 columns
6 columns

Sidebar layout (8 + 4)

Main content (8 columns)
Sidebar (4)

Spacing

Spacing is an important — and often overlooked — part of a design system. It is of paramount importance and must be used intelligently when designing a website. The term "make the website breathable" is often used by designers and it particularly refers to the spacing.

Use the scale

Whether it's a linear scale or a modular scale, adopting a standard is essential. By default, Tailwind includes a comprehensive numeric spacing scale.

Spacing units

Instead of arbitrary values, use standard units of spacing. This could be tied to a baseline grid and the size of a typographic element

Responsive adjustment

As screen sizes change, spacing might need to be adjusted. Account for changes in margins around the content area.

Visual balance

While mathematical consistency is essential, visual balance is equally critical. Always review designs to ensure that they feel right.

In essence, spacing isn't just about putting space between elements; it's a tool that can be used strategically to create clearer, more intuitive interfaces. As with any rule in design, understanding the rationale behind it is crucial because there will always be exceptions based on context.

The design system has increments of 2px until the base font size. Hence, up to 16px (1rem). After the base font size, the design system recommends using 4px as the increment up to 48px.

The screen size and the layout you want to design may be open to spacing, and hence we recommend a proportional ratio, so 16 is twice as much spacing as 8 for example.

Name Size Pixels Preview
0 0px 0px
px 1px 1px
0.5 0.125rem 2px
1 0.25rem 4px
1.5 0.375rem 6px
2 0.5rem 8px
2.5 0.625rem 10px
3 0.75rem 12px
3.5 0.875rem 14px
4 1rem 16px
4.5 1.1rem 18px
5 1.25rem 20px
6 1.5rem 24px
7 1.75rem 28px
8 2rem 32px
9 2.25rem 36px
10 2.5rem 40px
11 2.75rem 44px
12 3rem 48px
14 3.5rem 56px
16 4rem 64px
20 5rem 80px
24 6rem 96px
28 7rem 112px
32 8rem 128px
36 9rem 144px
40 10rem 160px
44 11rem 176px
48 12rem 192px
52 13rem 208px
56 14rem 224px
60 15rem 240px
64 16rem 256px
72 18rem 288px
80 20rem 320px
96 24rem 384px