---
url: /foundations/layout/grids-spacing/grids.md
description: Grids and spacing organize content and actions for any layout
---

# Grids & spacing

Grids and spacing organize content and actions for any layout

[Overview](overview.md) · **Grids** · [Spacing](spacing.md) · [Density](density.md)

* Layouts in Material are based on a grid that adapts across all [breakpoints](../breakpoints/overview.md "Breakpoints are opinionated window sizes where a layout changes to match available space, device conventions, and ergonomics (previously window size classes).") (previously window size classes)
* Parts of the layout [scaffold](../scaffold/overview.md "A scaffold is a fundamental UI design structure that provides a standard platform for assembling key screen components.") like rails and panes are positioned on this grid to create consistent adaptive layouts
* The structure and spacing values used in a grid can add personality to a product’s layout

## How to use grids

### Start with placing grid columns

Grids adapt across [breakpoints](../breakpoints/overview.md "Breakpoints are opinionated window sizes where a layout changes to match available space, device conventions, and ergonomics (previously window size classes)."). As the size increases, column count, width, and spacing change as well.

![A mockup of grid columns, showing compact, medium/expanded, and large/extra-large breakpoints.](/assets/b0bf0523-mp54500h-03.BwrlLE4f.webp)

The number and size of columns changes based on breakpoints

When moving between sizes, column count may increase to show more content or controls.

![A course listing on a compact screen, with 4 columns.](/assets/91ad44aa-mp54dby8-04.BUTTxtpl.webp)

On compact screens, fewer columns are used to create a focused layout

![A course listing on a foldable screen, with 8 columns.](/assets/1c843eac-mp4int8e-02.BrCvskiP.webp)

As screen size increases, for example when a foldable screen is unfolded, additional columns allow for a richer layout

### Place bars & rails

Populate regions of the layout [scaffold](../scaffold/overview.md "A scaffold is a fundamental UI design structure that provides a standard platform for assembling key screen components.") that are closest to the edges of the screen’s usable space first. This may include:

* Bars like the [navigation bar](../../../components/navigation-bar/overview.md "Navigation bars let people switch between UI views on smaller devices.") and [rail](../../../components/navigation-rail/overview.md "Navigation rails let people switch between UI views on mid-sized devices.")
* Components like [toolbars](../../../components/toolbars/overview.md "Toolbars display frequently used actions relevant to the current page.") and [app bars](../../../components/app-bars/overview.md "App bars contain page navigation and information at the top of a screen.")

![A compact screen with a toolbar highlighted.](/assets/65dccc8c-mp55v0r6-06.ByR40RDG.webp)

The bar region can contain a toolbar

![A large screen with a leading navigation rail highlighted.](/assets/32b9387a-mp55w2g9-07.C9Va69P-.webp)

The rail region on larger screens usually contains a navigation rail

### Place panes

Next, populate the main region of the screen with panes with content and components, based on available space and structure.

See the [canonical layout examples](../canonical-examples/overview.md) for ideas on which panes are appropriate for a product.

![Mobile UI with 1 pane. Foldable UI with 2 panes in a supporting pane layout.](/assets/5c011430-mp55yqda-08.iBc-wv-s.webp)

1. Primary pane
2. Supporting pane

## Rulers & alignment

Rulers are a set of recommended global alignment lines that help create consistent focal points in a product, while keeping content and components consistently aligned.

[How to implement rulers in Compose](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Ruler)

![1 compact and 1 desktop UI mapping rulers.](/assets/8fcfe054-mp56n0pg-09.j3_UB-PM.webp)

1. Margin
2. Bar or safety region
3. Title
4. Content 1
5. Content 2
6. Content 3
7. Content 4
8. Bar or safety region
9. Rail

### Bar & safety rulers

Bar and safety rulers reserve space for [system UI](https://developer.android.com/training/system-ui) elements like the status bar and gesture navigation.

They ensure actionable content like [app bars](../../../components/app-bars/overview.md "App bars contain page navigation and information at the top of a screen.") aren’t covered by system UI.

![2 mobile UIs showing bar and safety rulers at the top and bottom.](/assets/cce1bf20-mp573btr-10.DEwlJ8Ih.webp)

Bar and safety rulers align to the edges of a screen’s usable space, providing a reference for where system UI like the status bar or gesture navigation appear

### Title rulers

The title ruler creates consistency for the screen’s title, aligning the text, icons, and other components in an app bar.

![1 mobile and 1 desktop UI showing title rulers.](/assets/9a5d157a-mp574ab3-11-key02-to-publish.vm7trWwJ.webp)

The title ruler aligns with the title in an app bar

### Content rulers

Use content rulers to align and anchor key content, such as headlines and [carousels](../../../components/carousel/overview.md "Carousels show a collection of items that can be scrolled on and off the screen.").

* First content ruler: Emphasizes major blocks like hero images, headlines, or primary components
* Secondary rulers: Determine where supplementary text or actions begin

![1 mobile and 1 desktop UI showing content rulers.](/assets/84f7cef9-mp575wo3-12-key02-to-publish.Cq_hOqAj.webp)

Content rulers offer flexible alignment options to help create a consistent layout across a product

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmp5778zb-GM3%20-Layout%20-%20Grids%20%20-%20Spacing%20-13%20-%20Ruler%20Hero%20-%20IA%20-%20v02.mp4?alt=media" aria-label="Carousel and text resizing to align with content rulers, creating a structured layout."></video>

Realigning primary components or content to a content ruler can create strong hierarchy and visual rhythm across a product

### Ruler options

Margin rulers come with some wiggle room to determine how tight or loose a product’s content feels on-screen. The standard ruler can be adjusted to the left or right.

Choosing a narrower or wider margin can create or remove negative space, or create expressive moments in a content-forward product.

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmp578joa-GM3%20-Layout%20-%20Grids%20%20-%20Spacing%20-14%20-%20Ruler%20Options%20-%20IA%20-%20v02.mp4?alt=media" aria-label="Mobile UI showing a recipe layout where text margins narrow while the hero photo expands."></video>

Margin rulers can adjust to create more or less negative space

Rulers can also be used to create more immersive experiences. For example, a photo grid can take the full width of the screen, while components like [search](../../../components/search/overview.md "Search lets people enter a keyword or phrase to get relevant information.") use wider margins.

![Mobile UI for a photo app showing a full-width image grid and a search bar with wide margins.](/assets/a5889272-mp579mwo-15.o2bgNu4s.webp)

Rulers allow components and media to use different margin widths
