vue-screen
Version:
Reactive screen size and media query states for Vue. Integrates with most UI frameworks out of the box.
88 lines (64 loc) • 2.54 kB
Markdown
[](https://img.shields.io/badge/vue-3.x.x-brightgreen.svg)
[](https://github.com/reegodev/vue-screen/actions)
[](https://www.npmjs.com/package/vue-screen)
[](https://www.npmjs.com/package/vue-screen)
[](https://codecov.io/gh/reegodev/vue-screen)
<br>
> Warning: Version 2.x only supports Vue 3.<br> v1 docs are available [here](https://github.com/reegodev/vue-screen/tree/v1.5.3#vuescreen)
<br>
<img src="/packages/docs/src/public/logo.svg" alt="VueScreen logo" width="300" style="margin-top: 40px" />
Reactive screen size and media query states for Vue. Supports your favourite UI framework out of the box, and can be configured with any custom breakpoints.
[](https://reegodev.github.io/vue-screen)
- Reactive and debounced screen size<br>
- Reactive media query states and device orientation<br>
- Detect touch screen capability<br>
- Breakpoints for most common ui frameworks provided out of the box: Tailwind, Bootstrap, Bulma, Foundation, Materialize, Semantic UI<br>
- SSR compatible<br>
```bash
npm i vue-screen
```
```bash
yarn add vue-screen
```
```js
import { useScreen, useGrid } from 'vue-screen'
export default {
setup() {
const screen = useScreen()
const grid = useGrid('bulma')
return {
screen,
grid
}
}
}
```
For advanced configurations, check out the [docs website](https://reegodev.github.io/vue-screen/).
```js
import { createApp } from 'vue'
import VueScreen from 'vue-screen'
// In App.vue
createApp()
.use(VueScreen, 'bootstrap')
.mount('#app')
// In MyComponent.vue
<template>
<ul>
<li>Current breakpoint is: {{ $grid.breakpoint }}</li>
<li>Window width is: {{ $screen.width }}</li>
<li>Window height is: {{ $screen.height }}</li>
</ul>
</template>
```
v2 introduces a few breaking changes both in the configuration and in the API.
Read more about them in the [docs section](https://reegodev.github.io/vue-screen/guide/upgrading).
[](/LICENSE)