vue-breakpoints

Vue.js utility component to show and hide components based on breakpoints
21,591 188
Install
npm install vue-breakpoints
Latest Version:1.1.0
Vue:2
License:MIT
Last Updated:Dec 7, 2022
Links: GitHub  ·  npm
Maintainer: apertureless

vue-breakpoints

Build Status codecov npm vue2 license

Vue.js utility component to show and hide components based on breakpoints

📺 Demo

🔧 Install

yarn add vue-breakpoints

👈 Usage


<template>
  <nav>
    <hide-at breakpoint="medium">
      <mobile-nav />
    </hide-at>
    <show-at breakpoint="mediumAndAbove">
      <desktop-nav>
    </show-at>
  </nav>
</template>

<script>
  import {showAt, hideAt} from 'vue-breakpoints'
  export default {
    components: { hideAt, showAt }
  }
</script>

Breakpoints

You can pass following values as a breakpoint:

  • small
  • mediumAndBelow
  • medium
  • mediumAndAbove
  • largeAndBelow
  • large

Default Breakpoints

Default breakpoints are

small: 744,
medium: 1128,
large: Infinity

but they can be overwritten if you pass an object to the breakpoints prop.

<show-at :breakpoints="{small: 620, medium: 1280, large: 1600}" breakpoint="medium">

Props

prop default type description
breakpoints undefined Object Important that if you pass the object you only use small, medium and large as the childs.
breakpoint '' String Breakpoint where it should show or hide small, mediumAndBelow, medium, mediumAndAbove, largeAndBelow, large

:scroll: Changelog

Details changes for each release are documented in the CHANGELOG.md.

:exclamation: Issues

Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

:muscle: Contribution

Please make sure to read the Contributing Guide and Code of Conduct before making a pull request.

:copyright: License

MIT

Related Packages

vue-not-visible

Vue directive for conditional rendering (like v-if) element on screen smaller th...

932 22
simple-breakpoints

A simple js plugin to define conditionally check defined breakpoints

3,521
vue3-mq

Build responsive design into your Vue 3 app

563,882 45
vue-breakpoint-mixin

Package to use as a watcher for breakpoints

11,422 0

Version History

Version Released License
1.1.0 MIT
1.0.0 MIT
0.2.0 MIT
0.1.0 MIT