@polymer/iron-overlay-behavior

WebJar for @polymer/iron-overlay-behavior

License

License

BSD 3-Clause
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

polymer__iron-overlay-behavior
Last Version

Last Version

3.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

@polymer/iron-overlay-behavior
WebJar for @polymer/iron-overlay-behavior
Project URL

Project URL

https://www.webjars.org

Download polymer__iron-overlay-behavior

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/polymer__iron-overlay-behavior/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>polymer__iron-overlay-behavior</artifactId>
    <version>3.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/polymer__iron-overlay-behavior/
implementation 'org.webjars.npm:polymer__iron-overlay-behavior:3.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/polymer__iron-overlay-behavior/
implementation ("org.webjars.npm:polymer__iron-overlay-behavior:3.0.3")
'org.webjars.npm:polymer__iron-overlay-behavior:jar:3.0.3'
<dependency org="org.webjars.npm" name="polymer__iron-overlay-behavior" rev="3.0.3">
  <artifact name="polymer__iron-overlay-behavior" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='polymer__iron-overlay-behavior', version='3.0.3')
)
libraryDependencies += "org.webjars.npm" % "polymer__iron-overlay-behavior" % "3.0.3"
[org.webjars.npm/polymer__iron-overlay-behavior "3.0.3"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : polymer__iron-a11y-keys-behavior jar [3.0.0-pre.26,4)
org.webjars.npm : polymer__iron-fit-behavior jar [3.0.0-pre.26,4)
org.webjars.npm : polymer__iron-resizable-behavior jar [3.0.0-pre.26,4)
org.webjars.npm : polymer__polymer jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

Published on NPM Build status Published on webcomponents.org

IronOverlayBehavior

Use IronOverlayBehavior to implement an element that can be hidden or shown, and displays on top of other content. It includes an optional backdrop, and can be used to implement a variety of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.

See the demo source code for an example.

Closing and canceling

An overlay may be hidden by closing or canceling. The difference between close and cancel is user intent. Closing generally implies that the user acknowledged the content on the overlay. By default, it will cancel whenever the user taps outside it or presses the escape key. This behavior is configurable with the no-cancel-on-esc-key and the no-cancel-on-outside-click properties. close() should be called explicitly by the implementer when the user interacts with a control in the overlay element. When the dialog is canceled, the overlay fires an 'iron-overlay-canceled' event. Call preventDefault on this event to prevent the overlay from closing.

Positioning

By default the element is sized and positioned to fit and centered inside the window. You can position and size it manually using CSS. See Polymer.IronFitBehavior.

Backdrop

Set the with-backdrop attribute to display a backdrop behind the overlay. The backdrop is appended to <body> and is of type <iron-overlay-backdrop>. See its doc page for styling options.

In addition, with-backdrop will wrap the focus within the content in the light DOM. Override the _focusableNodes getter to achieve a different behavior.

Limitations

The element is styled to appear on top of other content by setting its z-index property. You must ensure no element has a stacking context with a higher z-index than its parent stacking context. You should place this element as a child of <body> whenever possible.

<iron-overlay-backdrop>

iron-overlay-backdrop is a backdrop used by Polymer.IronOverlayBehavior. It should be a singleton.

Styling

The following custom properties and mixins are available for styling.

Custom property Description Default
--iron-overlay-backdrop-background-color Backdrop background color #000
--iron-overlay-backdrop-opacity Backdrop opacity 0.6
--iron-overlay-backdrop Mixin applied to iron-overlay-backdrop. {}
--iron-overlay-backdrop-opened Mixin applied to iron-overlay-backdrop when it is displayed {}

See: Documentation, Demo.

Usage

Installation

npm install --save @polymer/iron-overlay-behavior

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {IronOverlayBehavior} from '@polymer/iron-overlay-behavior/iron-overlay-behavior.js';

class SampleElement extends mixinBehaviors(IronOverlayBehavior, PolymerElement) {
  static get template() {
    return html`
      <style>
        :host {
          background: white;
        }
      </style>
      <p>Overlay Content</p>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/iron-overlay-behavior
cd iron-overlay-behavior
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm
org.webjars.npm

Versions

Version
3.0.3
3.0.2