Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

vue3-mq-lite

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-mq-lite

Media queries for Vue 3

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

vue3-mq-lite

Lite version of mq libraries. Just define your breakpoints.

Not compatible with Vue 2

Table of Contents

  • Installation
  • Usage

Installation

Using NPM

npm install vue3-mq-lite

Usage

1.) Add plugin to Vue

You can define your custom breakpoints:

import { createApp } from 'vue';
import Mq from 'vue3-mq-lite';

const app = createApp({});

app.use(Mq, {
  xs: 576,
  sm: 768,
  md: 992,
  lg: 1200,
  xl: 1400,
  xxl: Infinity,
});

app.mount('#app');

2.) Default breakpoints

{
    sm: 450,
    md: 1250,
    lg: Infinity,
}

2.) Usage

For exact breakpoint:

<template>
  <div v-if="$mq.sm">mobile breakpoint</div>
  <div v-if="$mq.md">tablet breakpoint</div>
  <div v-if="$mq.lg">desktop breakpoint</div>
</template>

For breakpoints bigger than sm (include md):

<template>
  <div v-if="$mq.min.md">tablet and desktop breakpoint</div>
</template>

For breakpoints smaller than lg (include md):

<template>
  <div v-if="$mq.max.md">mobile and tablet breakpoint</div>
</template>

Keywords

vue3

FAQs

Package last updated on 25 Jul 2021

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