grain-responsive-behavior - Vaadin Add-on Directory
(no summary available)
**[ This description is mirrored from README.md at [github.com/daKmoR/grain-responsive-behavior](https://github.com//daKmoR/grain-responsive-behavior/blob/v0.8.1/README.md) on 2019-05-10 ]**
[![Polymer Version](https://img.shields.io/badge/polymer-v2-blue.svg)](https://www.polymer-project.org)
# \
Every element implementing this behavior do get an attribute for is-mobile, is-tablet, is-desktop when you resize the window.
You can use this information to change styles and/or attributes depending on it.
## Installation
```sh
$ bower install --save daKmoR/grain-responsive-behavior
```
## Getting Started
Import the package.
```html
```
Create your element using this behavior. You can now access is-mobile, is-tablet, is-desktop.
```js
class GrainResponsiveBehaviorExample extends GrainResponsiveBehavior(Polymer.Element) {
// your code
}
```
If you wish to have an responsive attribute you should create 3 attributes foo, mobileFoo, tabletFoo and init the Behavior with `this.initResponsiveBehaviorFor('foo');
```js
class GrainResponsiveBehaviorExample extends GrainResponsiveBehavior(Polymer.Element) {
static get is() { return 'grain-responsive-behavior-example' }
static get properties() {
return {
marked: {
type: String,
reflectToAttribute: true,
value: 'false', // 'true', 'false'
},
mobileMarked: { type: String, reflectToAttribute: true },
tabletMarked: { type: String, reflectToAttribute: true },
};
}
constructor() {
super();
this.initResponsiveBehaviorFor('marked');
}
}
```
*For more information, see the API documentation.*
## Working on the Element
First, make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed.
* View the Element via `polymer serve`
* Run tests via `polymer test`
GitHub HomepageIssue tracker
License
Documentation
View on GitHub
grain-responsive-behavior version 0.8.0
### Dependencies
Polymer/polymer#^2.0.0-rc.2
grain-responsive-behavior version 0.8.1
### Dependencies
Polymer/polymer#>=2.0.0-rc.2 <3.0