OLD | NEW |
1 # iron-overlay-behavior | |
2 Makes an element an overlay with an optional backdrop. | |
3 | 1 |
4 `iron-overlay-behavior` displays an element on top of other content. It starts o
ut hidden and is | 2 <!--- |
5 displayed by calling `open()` or setting the `opened` property to `true`. It may
be closed by | |
6 calling `close()` or `cancel()`, or by setting the `opened` property to `false`. | |
7 | 3 |
8 The difference between `close()` and `cancel()` is user intent. `close()` genera
lly implies that | 4 This README is automatically generated from the comments in these files: |
9 the user acknowledged the content of the overlay. By default, it will cancel whe
never the user taps | 5 iron-overlay-backdrop.html iron-overlay-behavior.html |
10 outside it or presses the escape key. This behavior can be turned off via the `n
o-cancel-on-esc-key` | 6 |
11 and the `no-cancel-on-outside-click` properties. | 7 Edit those files, and our readme bot will duplicate them over here! |
| 8 Edit this file, and the bot will squash your changes :) |
| 9 |
| 10 --> |
| 11 |
| 12 [](https://travis-ci.org/PolymerElements/iron-overlay-behavior) |
| 13 |
| 14 _[Demo and API Docs](https://elements.polymer-project.org/elements/iron-overlay-
behavior)_ |
| 15 |
| 16 |
| 17 ##<iron-overlay-backdrop> |
| 18 |
| 19 |
| 20 `iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It
should be a |
| 21 singleton. |
| 22 |
| 23 ### Styling |
| 24 |
| 25 The following custom properties and mixins are available for styling. |
| 26 |
| 27 Custom property | Description | Default |
| 28 -------------------------------------------|------------------------|--------- |
| 29 `--iron-overlay-backdrop-background-color` | Backdrop background color
| #000 |
| 30 `--iron-overlay-backdrop-opacity` | Backdrop opacity
| 0.6 |
| 31 `--iron-overlay-backdrop` | Mixin applied to `iron-overlay-back
drop`. | {} |
| 32 `--iron-overlay-backdrop-opened` | Mixin applied to `iron-overlay-back
drop` when it is displayed | {} |
| 33 |
| 34 |
| 35 ##Polymer.IronOverlayBehavior |
| 36 |
| 37 |
| 38 Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden or
shown, and displays |
| 39 on top of other content. It includes an optional backdrop, and can be used to im
plement a variety |
| 40 of UI controls including dialogs and drop downs. Multiple overlays may be displa
yed at once. |
| 41 |
| 42 ### Closing and canceling |
| 43 |
| 44 A dialog may be hidden by closing or canceling. The difference between close and
cancel is user |
| 45 intent. Closing generally implies that the user acknowledged the content on the
overlay. By default, |
| 46 it will cancel whenever the user taps outside it or presses the escape key. This
behavior is |
| 47 configurable with the `no-cancel-on-esc-key` and the `no-cancel-on-outside-click
` properties. |
| 48 `close()` should be called explicitly by the implementer when the user interacts
with a control |
| 49 in the overlay element. When the dialog is canceled, the overlay fires an 'iron-
overlay-canceled' |
| 50 event. Call `preventDefault` on this event to prevent the overlay from closing. |
| 51 |
| 52 ### Positioning |
| 53 |
| 54 By default the element is sized and positioned to fit and centered inside the wi
ndow. You can |
| 55 position and size it manually using CSS. See `Polymer.IronFitBehavior`. |
| 56 |
| 57 ### Backdrop |
| 58 |
| 59 Set the `with-backdrop` attribute to display a backdrop behind the overlay. The
backdrop is |
| 60 appended to `<body>` and is of type `<iron-overlay-backdrop>`. See its doc page
for styling |
| 61 options. |
| 62 |
| 63 ### Limitations |
| 64 |
| 65 The element is styled to appear on top of other content by setting its `z-index`
property. You |
| 66 must ensure no element has a stacking context with a higher `z-index` than its p
arent stacking |
| 67 context. You should place this element as a child of `<body>` whenever possible. |
| 68 |
| 69 |
OLD | NEW |