paper-dialog-behavior
Makes an element a Material Design dialog
PaperDialogBehavior
Use PaperDialogBehavior
and paper-dialog-shared-styles.js
to implement a Material Design
dialog.
For example, if <paper-dialog-impl>
implements this behavior:
<paper-dialog-impl>
<h2>Header</h2>
<div>Dialog body</div>
<div class="paper-dialog-buttons">
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm>Accept</paper-button>
</div>
</paper-dialog-impl>
paper-dialog-shared-styles.js
provide styles for a header, content area, and an action area for buttons.
Use the <h2>
tag for the header and the paper-dialog-buttons
or buttons
class for the action area. You can use the
paper-dialog-scrollable
element (in its own repository) if you need a scrolling content area.
Use the dialog-dismiss
and dialog-confirm
attributes on interactive controls to close the
dialog. If the user dismisses the dialog with dialog-confirm
, the closingReason
will update
to include confirmed: true
.
Accessibility
This element has role="dialog"
by default. Depending on the context, it may be more appropriate
to override this attribute with role="alertdialog"
.
If modal
is set, the element will prevent the focus from exiting the element.
It will also ensure that focus remains in the dialog.
See: Documentation, Demo.
Usage
Installation
npm install --save @polymer/paper-dialog-behavior
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {PaperDialogBehavior} from '@polymer/paper-dialog-behavior/paper-dialog-behavior.js';
class SampleElement extends mixinBehaviors(PaperDialogBehavior, PolymerElement) {
static get template() {
return html`
<style include="paper-dialog-shared-styles"></style>
<slot></slot>
`;
}
}
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/paper-dialog-behavior
cd paper-dialog-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
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Dependencies
- iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
- paper-styles#PolymerElements/paper-styles#1 - 2
- polymer#Polymer/polymer#1.9 - 2
- Released
- 2018-04-26
- Maturity
- IMPORTED
- License
- Other
Compatibility
- Framework
- Polymer 2.0+
- Polymer 1.0+ in 1.0.0
- Polymer 3.0+ in 0.0.1
- Browser
- Browser Independent
paper-dialog-behavior - Vaadin Add-on Directory
Makes an element a Material Design dialogHeader
` tag for the header and the `paper-dialog-buttons` or `buttons` class for the action area. You can use the
`paper-dialog-scrollable` element (in its own repository) if you need a scrolling content area.
Use the `dialog-dismiss` and `dialog-confirm` attributes on interactive controls to close the
dialog. If the user dismisses the dialog with `dialog-confirm`, the `closingReason` will update
to include `confirmed: true`.
### Accessibility
This element has `role="dialog"` by default. Depending on the context, it may be more appropriate
to override this attribute with `role="alertdialog"`.
If `modal` is set, the element will prevent the focus from exiting the element.
It will also ensure that focus remains in the dialog.
See: [Documentation](https://www.webcomponents.org/element/@polymer/paper-dialog-behavior),
[Demo](https://www.webcomponents.org/element/@polymer/paper-dialog-behavior/demo/demo/index.html).
## Usage
### Installation
```
npm install --save @polymer/paper-dialog-behavior
```
### In a Polymer 3 element
```js
import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {PaperDialogBehavior} from '@polymer/paper-dialog-behavior/paper-dialog-behavior.js';
class SampleElement extends mixinBehaviors(PaperDialogBehavior, PolymerElement) {
static get template() {
return html`
`;
}
}
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
```sh
git clone https://github.com/PolymerElements/paper-dialog-behavior
cd paper-dialog-behavior
npm install
npm install -g polymer-cli
```
### Running the demo locally
```sh
polymer serve --npm
open http://127.0.0.1:/demo/
```
### Running the tests
```sh
polymer test --npm
```
View on GitHub
License
paper-dialog-behavior version 0.9.0
### Dependencies
* polymer#Polymer/polymer#v0.9.0-rc.1
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^0.9.0
* paper-styles#PolymerElements/paper-styles#^0.9.0
paper-dialog-behavior version 0.9.1
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^0.9.0
* paper-styles#PolymerElements/paper-styles#^0.9.0
* polymer#Polymer/polymer#^0.9.0
paper-dialog-behavior version 0.9.2
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^0.9.0
* paper-styles#PolymerElements/paper-styles#^0.9.0
* polymer#Polymer/polymer#^0.9.0
paper-dialog-behavior version 0.9.3
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^0.9.0
* paper-styles#PolymerElements/paper-styles#^0.9.0
* polymer#Polymer/polymer#^0.9.0
paper-dialog-behavior version 0.9.4
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^0.9.0
* paper-styles#PolymerElements/paper-styles#^0.9.0
* polymer#Polymer/polymer#^0.9.0
paper-dialog-behavior version 1.0.0
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.0
* polymer#Polymer/polymer#^1.0.0
paper-dialog-behavior version 1.0.1
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.4
* polymer#Polymer/polymer#^1.0.0
paper-dialog-behavior version 1.0.2
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.4
* polymer#Polymer/polymer#^1.0.0
paper-dialog-behavior version 1.0.4
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.4
* polymer#Polymer/polymer#^1.0.0
paper-dialog-behavior version 1.0.5
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.4
* polymer#Polymer/polymer#^1.0.0
paper-dialog-behavior version 1.0.6
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.4
* polymer#Polymer/polymer#^1.0.0
paper-dialog-behavior version 1.1.0
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.0.4
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.1.1
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 0.0.1
### Dependencies
* @polymer/iron-overlay-behavior#^0.0.1
* @polymer/paper-styles#^0.0.1
* @polymer/polymer#^1.2.5-npm-test.2
paper-dialog-behavior version 0.0.3
### Dependencies
* @polymer/iron-overlay-behavior#^0.0.3
* @polymer/paper-styles#^0.0.3
* @polymer/polymer#^1.2.5-npm-test.2
paper-dialog-behavior version 1.2.0
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.1
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.2
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.3
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.4
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.5
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.6
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.7
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 1.2.8
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 2.0.0
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* paper-styles#PolymerElements/paper-styles#1 - 2
* polymer#Polymer/polymer#1.9 - 2
paper-dialog-behavior version 1.2.9
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^1.0.0
* paper-styles#PolymerElements/paper-styles#^1.1.0
* polymer#Polymer/polymer#^1.1.0
paper-dialog-behavior version 2.0.1
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* paper-styles#PolymerElements/paper-styles#1 - 2
* polymer#Polymer/polymer#1.9 - 2
paper-dialog-behavior version 3.0.0-pre.1
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.1
* @polymer/paper-styles#^3.0.0-pre.1
* @polymer/polymer#^3.0.0-pre.1
paper-dialog-behavior version 3.0.0-pre.2
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.1
* @polymer/paper-styles#^3.0.0-pre.1
* @polymer/polymer#^3.0.0-pre.1
paper-dialog-behavior version 3.0.0-pre.3
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.3
* @polymer/paper-styles#^3.0.0-pre.3
* @polymer/polymer#^3.0.0-pre.3
paper-dialog-behavior version 3.0.0-pre.4
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.4
* @polymer/paper-styles#^3.0.0-pre.4
* @polymer/polymer#^3.0.0-pre.4
paper-dialog-behavior version 3.0.0-pre.6
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.6
* @polymer/paper-styles#^3.0.0-pre.6
* @polymer/polymer#^3.0.0-pre.6
paper-dialog-behavior version 3.0.0-pre.7
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.7
* @polymer/paper-styles#^3.0.0-pre.7
* @polymer/polymer#^3.0.0-pre.7
paper-dialog-behavior version 3.0.0-pre.8
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.7
* @polymer/paper-styles#^3.0.0-pre.7
* @polymer/polymer#^3.0.0-pre.7
paper-dialog-behavior version 2.1.0
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* paper-styles#PolymerElements/paper-styles#1 - 2
* polymer#Polymer/polymer#1.9 - 2
paper-dialog-behavior version 2.2.0
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* paper-styles#PolymerElements/paper-styles#1 - 2
* polymer#Polymer/polymer#1.9 - 2
paper-dialog-behavior version 3.0.0-pre.10
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.10
* @polymer/paper-styles#^3.0.0-pre.10
* @polymer/polymer#^3.0.0-pre.10
paper-dialog-behavior version 3.0.0-pre.11
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.10
* @polymer/paper-styles#^3.0.0-pre.10
* @polymer/polymer#^3.0.0-pre.10
paper-dialog-behavior version 3.0.0-pre.12
### Dependencies
* @polymer/iron-overlay-behavior#3.0.0-pre.12
* @polymer/paper-styles#3.0.0-pre.12
* @polymer/polymer#3.0.0-pre.12
paper-dialog-behavior version 2.2.1
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* paper-styles#PolymerElements/paper-styles#1 - 2
* polymer#Polymer/polymer#1.9 - 2
paper-dialog-behavior version 2.2.2
### Dependencies
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* paper-styles#PolymerElements/paper-styles#1 - 2
* polymer#Polymer/polymer#1.9 - 2
paper-dialog-behavior version 3.0.0-pre.13
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.13
* @polymer/paper-styles#^3.0.0-pre.13
* @polymer/polymer#^3.0.0-pre.13
paper-dialog-behavior version 3.0.0-pre.14
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.14
* @polymer/paper-styles#^3.0.0-pre.14
* @polymer/polymer#^3.0.0-pre.13
paper-dialog-behavior version 3.0.0-pre.15
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.15
* @polymer/paper-styles#^3.0.0-pre.15
* @polymer/polymer#^3.0.0-pre.13
paper-dialog-behavior version 3.0.0-pre.16
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.16
* @polymer/paper-styles#^3.0.0-pre.16
* @polymer/polymer#^3.0.0-pre.13
paper-dialog-behavior version 3.0.0-pre.17
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.17
* @polymer/paper-styles#^3.0.0-pre.17
* @polymer/polymer#^3.0.0-pre.13
paper-dialog-behavior version 3.0.0-pre.18
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.18
* @polymer/paper-styles#^3.0.0-pre.18
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.19
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.19
* @polymer/paper-styles#^3.0.0-pre.19
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.20
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.20
* @polymer/paper-styles#^3.0.0-pre.20
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.21
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.21
* @polymer/paper-styles#^3.0.0-pre.21
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.22
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.20
* @polymer/paper-styles#^3.0.0-pre.20
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.23
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.23
* @polymer/paper-styles#^3.0.0-pre.22
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.24
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.23
* @polymer/paper-styles#^3.0.0-pre.22
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.25
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.25
* @polymer/paper-styles#^3.0.0-pre.24
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0-pre.26
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.26
* @polymer/paper-styles#^3.0.0-pre.25
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.0
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.27
* @polymer/paper-styles#^3.0.0-pre.26
* @polymer/polymer#^3.0.0
paper-dialog-behavior version 3.0.1
### Dependencies
* @polymer/iron-overlay-behavior#^3.0.0-pre.27
* @polymer/paper-styles#^3.0.0-pre.26
* @polymer/polymer#^3.0.0