Foundations

Layout

Consistent layout principles allow designers and developers to efficiently build user-friendly experiences across devices and screen sizes.

Layout Grid

Anatomy

Layout grids consists of 3 elements:

Columns

Columns may vary in width at different points within each breakpoint range but are always equal to each other. Content should be contained within the columns, but effects like shadows and hovers can expand into the margins or gutters.

Image of a 12 column layout on desktop

Gutter

Gutter widths are fixed within each breakpoint range. This provides a consistent visual order and prevents content overlap. Do not extend content into the gutters to keep spacing consistent. If additional horizontal space is needed between elements, increase the padding, not the gutter-width.

View of the 11 gutters in between the columns on desktop

Margin

Margins provide the white space beyond the content area and contribute to the comfort of the page. Margins provide a visual frame and prevent content from spilling over the viewable regions. Each breakpoint has specific margin widths and scale as the viewport shifts from one breakpoint to the next.

Image highlighting the margins of the page on desktop view

Usage

Column Layout Span

Mix and match column widths by spanning multiple columns for a wide variety of layout options. For more information, see Column Control options.

Illustration showing each spacing option of the column layout span

Responsive Layouts

Breakpoints

In responsive design, a breakpoint is the mark at which a website’s content and design will change to provide the optimal user experience within a given viewport range.

The responsive grid adjusts margin, body widths, and the number of columns when scaling a layout for different viewport ranges.

BreakpointsRangeColumnsGutterMargin
X-Small0 to 640px4

16px

16px
Small

641 to 991px

8

16px

24px
Medium

992 to 1439px

1224px32px
Large

1440px +

1224pxAuto

Fluid vs Fixed Grid

The X-Small, Small, and Medium breakpoints use a fluid grid, meaning the grid spans 100% of the viewport width and column widths are defined in percentages, adjusting in size as the screen size changes. The margins are set to fixed pixel sizes based on the viewport size.

However, at the Large breakpoint (1440px and above), the grid becomes fixed, with the content area fixed at 1200px. The margins are set to 'Auto,' meaning they will simply fill any additional space beyond the fixed 1200px content area. This prevents components from becoming excessively large on ultra wide displays.

Illustration showing each of the four breakpoint options, showing how the X-Small, Small and Medium are fluid width while the large breakpoint shows a fixed width.

Example

In the example below, you can see how a Content Group - Cards component would reflow its content across various breakpoints.

Example of the Content Group - Cards component on desktop, tablet, and phone viewports

In this example, the cards within the three-column (33%, 33%, 33%) layout stack to a single column on tablet and mobile devices.

Spacing

Introduction

Keystone uses uniform components, elements, and spacing to encourage consistency when designing for digital government experiences.

Spacing is the negative area between elements and components. It is commonly controlled in code with margin and padding. Keystone offers several methods such as tokens and layout components to make implementing spacing in designs easier and more consistent.

Spacing

The Keystone spacing scale complements the layout grid and typography scale by using multiples of two, four, and eight. It includes both small increments needed to create appropriate spatial relationships for detail-level designs as well as larger increments used to control the density of a design.

Each level of the spacing scale has its own token. Spacing tokens can be used inside of components for building and between components for layout spacing.

Spacing Scale

Use the spacing scale when building individual components. It includes small increments needed to create appropriate spatial relationships for detail-level designs. This scale is applied and used within all Keystone components.

TokenREMPX

space-1

0.063

1

space-2

0.125

2

space-3

0.25

4

space-4

0.58

space-5

0.7512

space-6

116

space-7

1.2520

space-8

1.524

space-9

232

space-10

2.540

space-11

348

space-12

3.656

space-13

464

space-14

580

space-15

696

space-16

7.5120