Quasar breakpoints are five named window widths (xs, sm, md, lg, xl) that drive three things at once: the responsive grid classes, the visibility classes, and the $q.screen object in JavaScript. Most responsive bugs in a Quasar app come from one of those three disagreeing with what you expected. Today there's a free tool that makes them visible: the Breakpoint Visualizer. Resize the window and watch $q.screen change. This post covers how the tool works, then the rules behind it: the exact pixel thresholds, what every $q.screen flag means, and the difference between setSizes and changing the breakpoints in Sass. Everything here is checked against Quasar 2.35.2.
The Breakpoint Visualizer runs in your browser, with no sign-in and no network calls. It has four parts:
$q.screen. The current breakpoint name, the width and height in pixels, and every xs to xl, lt and gt flag, updated as you drag the window edge, on a ruler that marks where your window sits. It's the fastest way to answer "is 1024px sm or md?" (it's md).sm ends at 1023.98px, and the xs, lt-md, gt-sm style classes, each marked as showing or hiding its element at the current width.sm, md, lg and xl start, and copy the matching Sass variables and a Screen.setSizes() call, as a Quasar CLI boot file or a Nuxt plugin.gt-sm, gt-xs lt-lg and so on) and the $q.screen condition for a v-if that match.Keep it open in a second window while you build a layout. When a column wraps at the wrong width or a menu button refuses to appear, the readout tells you which breakpoint you're actually in.
These are the defaults in Quasar 2.35.2:
| Name | From | To |
|---|---|---|
xs | 0px | 599.98px |
sm | 600px | 1023.98px |
md | 1024px | 1439.98px |
lg | 1440px | 1919.98px |
xl | 1920px | no limit |
The .98 maximums exist so that a fractional width (on a zoomed page, say) can never match two ranges at once.
The CSS uses the same numbers everywhere. A grid class like col-md-6 applies from 1024px up, which is the mobile-first rule the Quasar flex grid post explains in detail. A visibility class like gt-sm hides an element below 1024px. And $q.screen reports the same thresholds to your JavaScript.
$q.screen is the Screen plugin, and Quasar installs it for you. Every property is reactive, so a template or a computed that reads it updates when the window is resized.
<script setup lang="ts">
import { computed } from 'vue'
import { useQuasar } from 'quasar'
const $q = useQuasar()
const columns = computed(() => {
if ($q.screen.lt.sm) return 1
if ($q.screen.lt.md) return 2
return 4
})
</script>
<template>
<q-list :dense="$q.screen.lt.md">
<q-item>{{ $q.screen.name }}: {{ $q.screen.width }}px, {{ columns }} columns</q-item>
</q-list>
</template>Here's what each property means at a width of 800px (an sm window):
| Property | Meaning | At 800px |
|---|---|---|
name | The current breakpoint | 'sm' |
width, height | Window size in pixels | 800, … |
xs, sm, md, lg, xl | True only inside that one range | sm is true, the rest false |
lt.sm, lt.md, lt.lg, lt.xl | Narrower than that breakpoint's start | lt.sm false, lt.md true, lt.lg true, lt.xl true |
gt.xs, gt.sm, gt.md, gt.lg | Wider than that breakpoint's end | gt.xs true, gt.sm false, … |
sizes | The start of each breakpoint | { sm: 600, md: 1024, lg: 1440, xl: 1920 } |
Two details trip people up:
lt.xs and no gt.xl. Nothing is narrower than xs or wider than xl. Use $q.screen.xs or $q.screen.xl instead.gt.sm means "md and up", not "wider than 600". The gt flags compare against the end of a range, so gt.sm is true from 1024px. If you think in "from" widths, gt.xs is "600 and up", gt.sm is "1024 and up", and so on.The classes follow the same names. $q.screen.gt.sm in JavaScript and the gt-sm class in a template describe the same windows, which makes it easy to switch between them.
On desktop browsers, $q.screen.width includes the vertical scrollbar, the same way CSS media queries do. That's deliberate: a page that switches layout at 1024px in CSS and in JavaScript switches at the same moment. Updates are debounced; call $q.screen.setDebounce(ms) to change the delay.
Since Quasar 2.34, $q.screen.orientation also reports the device's orientation (portrait and landscape flags, plus type and angle). It's the physical screen's orientation, not the window's shape, so a narrow desktop window still reports landscape.
On the server, there is no window. During SSR, $q.screen reports its defaults: name is 'xs', width is 0 and every lt flag is true. On the client, Quasar waits until hydration is finished before it reads the real window size, so the first client render matches the server HTML. Then the values update and anything bound to $q.screen re-renders.
That means a v-if="$q.screen.gt.sm" renders nothing in the server HTML and pops in after hydration. For things that are visible on first paint, like a header's navigation links, a CSS class is better: the browser applies media queries before any JavaScript runs. Use $q.screen for what CSS can't express, like a prop value (:dense, :vertical, :maximized), a number of items to fetch, or a component that shouldn't exist at all on small screens. The visibility classes (gt-sm, lt-md, xs and the platform classes) have a companion post today.
There are two ways to change the breakpoints, and they don't do the same thing.
// app/plugins/screen-sizes.client.ts (Nuxt)
import { Screen } from 'quasar'
export default defineNuxtPlugin(() => {
Screen.setSizes({ sm: 768, md: 992, lg: 1200, xl: 1600 })
})In a Quasar CLI app, put the same Screen.setSizes() call in a boot file. Each key is the width where that breakpoint starts, and you can pass only the ones you want to change.
The Quasar docs are explicit about the catch: setSizes does not change the CSS breakpoints. After the call above, $q.screen.md turns true at 992px, but col-md-6 and gt-sm still switch at 1024px. That's fine if you only read $q.screen and never use the responsive classes. In most apps, it creates two sets of breakpoints that disagree by a few dozen pixels, which is exactly the kind of bug that's hard to spot without the visualizer open.
If you want different breakpoints everywhere, change them in your Quasar Sass variables file instead. Each variable is the last pixel of a range:
// app/assets/quasar-variables.scss (Nuxt) or src/css/quasar.variables.scss (Quasar CLI)
$breakpoint-xs: 767px; // sm starts at 768px
$breakpoint-sm: 991px; // md starts at 992px
$breakpoint-md: 1199px; // lg starts at 1200px
$breakpoint-lg: 1599px; // xl starts at 1600pxIn Nuxt with nuxt-quasar-ui, the file must be the one the module's sassVariables option points to, so Quasar's CSS is compiled from Sass with your values.
Now the grid and visibility classes switch at the new widths. And $q.screen follows them too, without a setSizes call: Quasar's CSS publishes the breakpoints as custom properties (--q-size-sm, --q-size-md and so on, on :root), and the Screen plugin reads those properties when it starts. One change in Sass keeps CSS and JavaScript in step.
Use Sass when you can, and setSizes only when you can't rebuild Quasar's CSS (an app that loads the prebuilt quasar.css, for example) or when you deliberately want JavaScript-only breakpoints.
For your own styles, use the same Sass variables rather than hard-coded numbers, so a later change to the breakpoints reaches them too:
.pricing-grid {
display: grid;
grid-template-columns: 1fr;
@media (min-width: $breakpoint-md-min) {
grid-template-columns: repeat(3, 1fr);
}
}Each breakpoint has a -min and a -max variable ($breakpoint-sm-min is 600px, $breakpoint-sm-max is 1023.98px by default). There's also an opt-in way to style by breakpoint without media queries: set framework.config.screen.bodyClasses to true in the Quasar CLI config, and Quasar adds screen--xs, screen--sm and so on to <body>. The docs note that it slightly delays the first meaningful paint, so media queries remain the default choice.
Is 1024px sm or md? md. Every breakpoint includes its starting width, so 600px is sm, 1024px is md and 1440px is lg.
What is the difference between $q.screen.md and $q.screen.gt.sm? md is true only between 1024px and 1439.98px. gt.sm is true from 1024px up, including lg and xl.
Can I use $q.screen outside a component? Yes. Import Screen from quasar and read Screen.gt.md, Screen.name and the rest. It's the same reactive object.
Why does my layout flash on page load with SSR? Something is bound to $q.screen, which reports xs until hydration finishes. Switch that part to a CSS class, or accept the flash for parts below the fold.
Does QDrawer use these breakpoints? QDrawer has its own breakpoint prop: the layout width up to which it uses mobile mode, 1023 by default. It's a plain number, so if you change the breakpoints, set that prop to match.
Open the Breakpoint Visualizer, drag the window from phone width to desktop and watch every $q.screen flag flip. If you're moving to custom sizes, copy the Sass variables it generates, and the setSizes call only if you can't rebuild Quasar's CSS.