# vue-container-query

> **Totally based on [d6u/react-container-query](https://github.com/d6u/react-container-query).**

Latest version **0.1.0** (published 2018-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-container-query
pnpm add vue-container-query
yarn add vue-container-query
bun add vue-container-query
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-08-18 |
| First published | 2018-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 1.5 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | wemlion |

## Links

- npm: https://www.npmjs.com/package/vue-container-query
- npm.io page: https://npm.io/package/vue-container-query

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^2.5.17
- [resize-observer-lite](https://npm.io/package/resize-observer-lite.md) ^0.2.3
- [container-query-toolkit](https://npm.io/package/container-query-toolkit.md) ^0.1.3

## Recent versions

- 0.1.0 (latest) — 2018-08-18

## README

# vue-container-query

**Totally based on [d6u/react-container-query](https://github.com/d6u/react-container-query).**

## Notice

The following documentation is also originated from [d6u/react-container-query](https://github.com/d6u/react-container-query).

Your suggested to pay a visit to the repo `react-container-query`.

## Installation

```sh
npm i -D vue-container-query
```

## API

### `<container-query :query="query" :initialSize="{ width, height } />`

```html
<template>
  <container-query
    :query="query"
    v-model="params"
    @change="handleChange"
  >
    <pre class="app">{{ params }}</pre>
  </container-query>
</template>

<script>
import { ContainerQuery } from './'

const query = {
  'width-between-400-and-599': {
    minWidth: 400,
    maxWidth: 599
  },
  'width-larger-than-600': {
    minWidth: 600
  }
}

export default {
  components: { ContainerQuery },
  data () {
    return { query, params: {} }
  },
  methods: {
    handleChange () {}
  }
}
</script>
```

#### properties

- `props.children`

  There should only be **one, and exactly one ** child component.

- `props.query`

  "query" is key-value pairs where keys are the class names that will be applied to container element when all constraints are met. The values are the constraints.

- `props.initialSize` (optional)

  `initialSize` is an object with optional `width` or `height` property. Because the limitation on how size is computed based on underlying element, in the initial rendering pass, we don't have the size info (because element must be in the DOM have a valid size). At this time `initialSize` will be used as the size of the element.

### `createContainerQueryMixin(query, initialSize)`

```html

<template>
  <pre class="app">{{ containerQuery }}</pre>
</template>

<script>
import { createContainerQueryMixin } from './'

const query = {
  'width-between-400-and-599': {
    minWidth: 400,
    maxWidth: 599
  },
  'width-larger-than-600': {
    minWidth: 600
  }
}

export default {
  mixins: [
    createContainerQueryMixin(query)
  ]
}
</script>
```

---
_Source: https://npm.io/package/vue-container-query · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
