Skip to content

Breakpoints ​

Breakpoints are customizable widths that determine how your responsive layout behaves across device or viewport sizes.

On this page ​


Core concepts ​

  • Breakpoints are the building blocks of responsive design. Use them to control when your layout adapts at a particular viewport or device size.
  • Media queries let you conditionally apply styles based on browser and viewport parameters. We commonly use min-width in our media queries.
  • Mobile-first responsive design is the goal. Apply the minimum styles for the smallest breakpoint, then layer on styles for larger devices. This optimizes CSS and improves rendering.

Available breakpoints ​

Grundtone includes six default breakpoints for building responsively:

BreakpointClass infixDimensions
Extra smallNone<640px
Smallsm≥640px
Mediummd≥768px
Largelg≥1024px
Extra largexl≥1280px
2X large2xl≥1536px

These breakpoints are customizable via Sass — see Theme Configuration for override syntax.

All breakpoint values come from a single source of truth (src/core/_breakpoints-defaults.scss). Every other file that needs breakpoints — grid utilities, container max-widths, :root CSS custom properties, and @property registrations — derives from this one map. When you override $grid-breakpoints, everything updates automatically.

scss
@use '@grundtone/design-system/scss' with (
  $grid-breakpoints: (
    xs: 0,
    sm: 576px,
    md: 768px,
    lg: 992px,
    xl: 1200px,
    2xl: 1400px,
  )
);

Media queries ​

The design-system package provides Sass mixins for responsive layouts. When writing custom SCSS that imports from the design-system source, use the mixins. (If using only the pre-built CSS, use the utility class prefixes like md:, lg: instead.)

Min-width ​

Apply styles from a breakpoint and up. Use the media-breakpoint-up mixin from the design-system breakpoints module:

scss
@use '@grundtone/design-system/scss/breakpoints' as bp;

// No media query for xs – it's effectively min-width: 0
@include bp.media-breakpoint-up(sm) {
  .my-class {
    display: block;
  }
}

@include bp.media-breakpoint-up(md) {
  .my-class {
    padding: 1rem;
  }
}

Compiled CSS:

css
/* Small devices (640px and up) */
@media (min-width: 640px) {
  .my-class {
    display: block;
  }
}

/* Medium devices (768px and up) */
@media (min-width: 768px) {
  .my-class {
    padding: 1rem;
  }
}

Max-width ​

Apply styles at a breakpoint and down (given screen size or smaller):

scss
@use '@grundtone/design-system/scss/breakpoints' as bp;

@include bp.media-breakpoint-down(sm) {
  /* styles for <640px */
}

@include bp.media-breakpoint-down(md) {
  /* styles for <768px */
}

@include bp.media-breakpoint-down(lg) {
  /* styles for <1024px */
}

Compiled CSS (.02px is subtracted to avoid overlap at fractional viewport widths):

css
/* sm and down: less than 640px */
@media (max-width: 639.98px) {
  /* ... */
}

/* md and down: less than 768px */
@media (max-width: 767.98px) {
  /* ... */
}

/* lg and down: less than 1024px */
@media (max-width: 1023.98px) {
  /* ... */
}

Single breakpoint ​

Target a single range of screen sizes:

scss
@use '@grundtone/design-system/scss/breakpoints' as bp;

@include bp.media-breakpoint-only(md) {
  .my-class {
    /* only between 768px and 1023.98px */
  }
}

Compiled:

css
@media (min-width: 768px) and (max-width: 1023.98px) {
  .my-class {
    /* ... */
  }
}

Between breakpoints ​

Target a range spanning multiple breakpoints:

scss
@use '@grundtone/design-system/scss/breakpoints' as bp;

@include bp.media-breakpoint-between(md, xl) {
  .my-class {
    /* from 768px up to 1279.98px */
  }
}

Compiled:

css
@media (min-width: 768px) and (max-width: 1279.98px) {
  .my-class {
    /* ... */
  }
}

Utility classes ​

Spacing, display, flexbox, text-align, width, and grid utilities use these breakpoints as prefixes:

  • sm:, md:, lg:, xl:, 2xl: for media query variants (e.g. md:p-4, lg:flex)
  • cq-sm:, cq-md:, cq-lg:, cq-xl: for container query variants

See Grid Utility for grid-specific breakpoint usage and Containers for container-specific breakpoint usage.


Architecture ​

All breakpoint values flow from one file to avoid duplication:

All files live in src/ — there is no separate scss/ directory.

FileRole
src/core/_breakpoints-defaults.scssSingle source of truth — defines $grid-breakpoints-default map
src/core/_breakpoints.scssMixins (media-breakpoint-up, etc.), functions, :root CSS var export
src/breakpoints.scssPublic entry point for @use '@grundtone/design-system/scss/breakpoints'
src/utilities/_grid.scssResponsive grid classes (sm:grid-cols-N, etc.)
src/utilities/_containers.scssLayout containers (.container, .container-{bp}, etc.)
src/core/_registered-properties.scss@property --breakpoint-* declarations (generated from map)
src/index.scssFull CSS entry point (compiles to dist/index.css)
src/lib.scssSCSS-only API (mixins, functions, variables — no CSS output)

Container max-widths are computed dynamically from $grid-breakpoints via calc(breakpoint - gutter * 2) — no separate map to maintain. See Containers for details.