Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Deprecated Nuxt.js module providing reactive ResizeObserver-based breakpoints via $breakpoints.
nuxt-breakpoints is a Nuxt.js 2 module that uses the Resize Observer API to expose viewport breakpoints as computed properties on the Vue instance, making it possible to read the current breakpoint in JavaScript. This repository is explicitly deprecated by its creator Steven Ho, who recommends modern alternatives such as VueUse's useBreakpoints for Vue 3 projects.
nuxt-breakpoints is a client-side Nuxt.js module that adds a special $breakpoints object to your Vue components. You configure breakpoint names and pixel widths in nuxt.config.js, and the module tracks the browser window size through ResizeObserver, updating the reactive breakpoint flags automatically as the viewport changes. The module outputs boolean properties for each configured breakpoint plus convenience prefixes for "larger than" and "smaller than" comparisons, for example lSm means "equal to or larger than sm" and sMd means "equal to or smaller than md".
$breakpoints object exposes booleans like md or lg that update in real time when the browser is resized.lSm, lMd, lLg and sSm, sMd, sLg to test whether the viewport is larger or smaller than a given breakpoint, inclusive of that breakpoint.polyfill option defaults to true, so resize-observer-polyfill is auto-imported when the browser does not support ResizeObserver.throttle option defaults to 200 milliseconds, slowing down the trigger frequency while the window is resizing.'nuxt-breakpoints' to the modules array in nuxt.config.js; module options can be passed directly or through a breakpoints key.nuxt-breakpoints targets Nuxt.js 2 developers who need to react to breakpoint changes inside JavaScript logic, not just in CSS media queries. It is useful for conditionally rendering components, adjusting chart dimensions, or switching layout behavior based on the active viewport in a server-side-rendered Nuxt app. Because it is a module rather than a plugin, developers can configure it globally and access it from any component without repeating setup.
$breakpoints.lg is false.Installation happens in two steps: add the dependency, then register 'nuxt-breakpoints' in the modules array of nuxt.config.js. The module reads your breakpoint configuration, attaches a ResizeObserver to the window, and sets the $breakpoints reactive properties on the Nuxt context and Vue instance. When the viewport crosses a breakpoint threshold, the module updates the relevant boolean flags immediately.
Because this project is deprecated, the author points to VueUse's useBreakpoints as a better alternative for Vue 3 users. On a broader level, the native MediaQueryList API and the Resize Observer API itself provide lower-level ways to achieve similar responsive behavior without a dedicated module.
Yes, this module is released under the MIT License.
No. The repository is explicitly marked as deprecated. The author decided to stop maintaining it and recommends using VueUse's useBreakpoints or the native MediaQueryList API instead.
The default breakpoints are sm 576, md 768, lg 992, and xl 1200 pixels. The xs breakpoint covers everything below sm.
No. This module was built for Nuxt 2. For Nuxt 3, the author recommends VueUse's useBreakpoints which works with the composition API.
lSm or sMd syntax?The l prefix means "larger than" and s means "smaller than", both including the breakpoint itself. So lSm is true when the viewport is equal to or larger than sm, and sMd is true when the viewport is equal to or smaller than md.
