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.
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.
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.
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.
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.
Breakpoints | Range | Columns | Gutter | Margin |
---|---|---|---|---|
X-Small | 0 to 640px | 4 | 16px | 16px |
Small | 641 to 991px | 8 | 16px | 24px |
Medium | 992 to 1439px | 12 | 24px | 32px |
Large | 1440px + | 12 | 24px | Auto |
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.
Example
In the example below, you can see how a Content Group - Cards component would reflow its content across various breakpoints.
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.
Token | REM | PX |
---|---|---|
space-1 | 0.063 | 1 |
space-2 | 0.125 | 2 |
space-3 | 0.25 | 4 |
space-4 | 0.5 | 8 |
space-5 | 0.75 | 12 |
space-6 | 1 | 16 |
space-7 | 1.25 | 20 |
space-8 | 1.5 | 24 |
space-9 | 2 | 32 |
space-10 | 2.5 | 40 |
space-11 | 3 | 48 |
space-12 | 3.6 | 56 |
space-13 | 4 | 64 |
space-14 | 5 | 80 |
space-15 | 6 | 96 |
space-16 | 7.5 | 120 |