Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo
Mode
Accessibility
Vuetify

useBreakpoints

The useBreakpoints composable provides comprehensive responsive design capabilities through reactive viewport dimension detection. It automatically tracks window size changes and provides boolean flags for current breakpoint ranges, enabling mobile-first and responsive layouts.

Intermediate95.2% coverageJan 11, 2026

Installation

Install the Breakpoints plugin in your app’s entry point:

main.ts
import { createApp } from 'vue'
import { createBreakpointsPlugin } from '@vuetify/v0'
import App from './App.vue'

const app = createApp(App)

app.use(
  createBreakpointsPlugin({
    mobileBreakpoint: 'sm',
    breakpoints: {
      xs: 0,
      sm: 680,
      md: 1024,
      lg: 1280,
      xl: 1920,
      xxl: 2560,
    },
  })
)

app.mount('#app')

Usage

Once the plugin is installed, use the useBreakpoints composable in any component:

UseBreakpoints
<script setup lang="ts">
  import { useBreakpoints } from '@vuetify/v0'

  const breakpoints = useBreakpoints()
</script>

<template>
  <div>
    <nav v-if="breakpoints.mdAndUp">
      <!-- Desktop navigation -->
    </nav>
    <nav v-else>
      <!-- Mobile navigation -->
    </nav>

    <p v-if="breakpoints.isMobile">Mobile layout active</p>
    <p>Current breakpoint: {{ breakpoints.name }}</p>
    <p>Viewport: {{ breakpoints.width }} x {{ breakpoints.height }}</p>
  </div>
</template>

Architecture

useBreakpoints uses the plugin pattern with viewport observation:

Breakpoints Plugin

Use controls to zoom and pan. Click outside or press Escape to close.

Breakpoints Plugin

API Reference

The following API details are for the useBreakpoints composable.

Functions

createBreakpoints

(_options?: BreakpointsOptions) => E

Creates a new breakpoints instance.

createBreakpointsContext

(_options?: BreakpointsContextOptions) => ContextTrinity<E>

Creates a new breakpoints context.

createBreakpointsPlugin

(_options?: BreakpointsPluginOptions) => any

Creates a new breakpoints plugin.

useBreakpoints

(namespace?: string) => E

Returns the current breakpoints instance.

Options

namespace

string

mobileBreakpoint

number | BreakpointName

breakpoints

Partial<Record<BreakpointName, number>>

Properties

breakpoints

Readonly<Record<BreakpointName, number>>

name

Readonly<ShallowRef<BreakpointName>>

width

Readonly<ShallowRef<number>>

height

Readonly<ShallowRef<number>>

isMobile

Readonly<ShallowRef<boolean>>

xs

Readonly<ShallowRef<boolean>>

sm

Readonly<ShallowRef<boolean>>

md

Readonly<ShallowRef<boolean>>

lg

Readonly<ShallowRef<boolean>>

xl

Readonly<ShallowRef<boolean>>

xxl

Readonly<ShallowRef<boolean>>

smAndUp

Readonly<ShallowRef<boolean>>

mdAndUp

Readonly<ShallowRef<boolean>>

lgAndUp

Readonly<ShallowRef<boolean>>

xlAndUp

Readonly<ShallowRef<boolean>>

xxlAndUp

Readonly<ShallowRef<boolean>>

smAndDown

Readonly<ShallowRef<boolean>>

mdAndDown

Readonly<ShallowRef<boolean>>

lgAndDown

Readonly<ShallowRef<boolean>>

xlAndDown

Readonly<ShallowRef<boolean>>

xxlAndDown

Readonly<ShallowRef<boolean>>

Methods

update

() => void
Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/