New: Introducing PHP and Composer Support.Read the Announcement
Socket
Book a DemoInstallSign in
Socket

@frankhoodbs/breakpoints

Package Overview
Dependencies
Maintainers
4
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frankhoodbs/breakpoints

Simple utility to handle breakpoints responsiveness

npmnpm
Version
5.0.0
Version published
Weekly downloads
60
2900%
Maintainers
4
Weekly downloads
 
Created
Source

Vue Breakpoints Utility

A Vue 3 utility that offers a streamlined interface for working with CSS breakpoints, leveraging CSS custom properties (or CSS variables) defined within the :root selector. This utility taps into the css-custom-properties-list dependency to extract the custom properties and provides handy methods to manage media queries within Vue.

Key Features

  • Automatic Breakpoint Extraction: Identifies and handles breakpoints straight from CSS custom properties.
  • Vue Integration: Harnesses Vue's reactivity to provide real-time information about the current breakpoints and media query utilities.
  • Prefix Support: Supports custom prefixes for breakpoint variable names.

Version License

Usage

To get started, first import and initialize the Breakpoints class:

import { Breakpoints } from '@your-package/vue-breakpoints-utility';

const breakpointsUtility = new Breakpoints(document.documentElement, document.styleSheets);

Accessing the Current Breakpoint

You can easily get the current active breakpoint:

console.log(breakpointsUtility.currentBreakpoint.value); // e.g. 'md'

Utility Methods for Media Queries

The utility offers a range of methods designed to facilitate media query management. Here are some of the most common uses:

  • And Up - Returns true if the viewport width is at or above the specified breakpoint:
if (breakpointsUtility.utilityMethods.mdAndUp.value) {
  // Code for medium devices and above
}
  • And Down - Returns true if the viewport width is at or below the specified breakpoint:
if (breakpointsUtility.utilityMethods.lgAndDown.value) {
  // Code for large devices and below
}
  • Only - Returns true only for the specific breakpoint:
if (breakpointsUtility.utilityMethods.lgOnly.value) {
  // Code exclusive to large devices
}

These utilities harness Vue's reactivity, ensuring your UI or logic adapts in real-time to viewport changes. This should give a comprehensive guide on the utility's usage, including the main methods that were mentioned in the code.

Dependencies

  • @vueuse/core: Used for harnessing the reactivity of Vue 3.
  • @frankhoodbs/css-custom-properties-list: Employed to extract CSS custom properties.

FAQs

Package last updated on 24 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts