3.0.1 • Published 6 years ago

@polymer/paper-dialog v3.0.1

Weekly downloads
9,250
License
BSD-3-Clause
Repository
github
Last release
6 years ago

Published on NPM Build status Published on webcomponents.org

<paper-dialog>

<paper-dialog> is a dialog with Material Design styling and optional animations when it is opened or closed. It provides styles for a header, content area, and an action area for buttons. You can use the <paper-dialog-scrollable> element (in its own repository) if you need a scrolling content area. To autofocus a specific child element after opening the dialog, give it the autofocus attribute. See PaperDialogBehavior and IronOverlayBehavior for specifics.

For example, the following code implements a dialog with a header, scrolling content area and buttons. Focus will be given to the dialog-confirm button when the dialog is opened.

<paper-dialog>
  <h2>Header</h2>
  <paper-dialog-scrollable>
    Lorem ipsum...
  </paper-dialog-scrollable>
  <div class="buttons">
    <paper-button dialog-dismiss>Cancel</paper-button>
    <paper-button dialog-confirm autofocus>Accept</paper-button>
  </div>
</paper-dialog>

Styling

See the docs for PaperDialogBehavior for the custom properties available for styling this element.

Animations

Set the entry-animation and/or exit-animation attributes to add an animation when the dialog is opened or closed. See the documentation in PolymerElements/neon-animation for more info.

For example:

<script type="module">
  import '@polymer/neon-animation/animations/scale-up-animation.js';
  import '@polymer/neon-animation/animations/fade-out-animation.js';
</script>

<paper-dialog entry-animation="scale-up-animation"
              exit-animation="fade-out-animation">
  <h2>Header</h2>
  <div>Dialog body</div>
</paper-dialog>

Accessibility

See the docs for PaperDialogBehavior for accessibility features implemented by this element.

See: Documentation, Demo.

Usage

Installation

npm install --save @polymer/paper-dialog

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/paper-dialog/paper-dialog.js';
    </script>
  </head>
  <body>
    <paper-dialog>
      <h2>Content</h2>
    </paper-dialog>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/paper-dialog/paper-dialog.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <paper-dialog>
        <h2>Content</h2>
      </paper-dialog>
    `;
  }
}
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
cd paper-dialog
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
fundwave-fund-managementzagenzagen-productionzagen-zagen@teipublisher/pb-components7contact-dialog2@phil-cd/frontendtest2@infinitebrahmanuniverse/nolb-_pol@everything-registry/sub-chunk-731nodecgtest-contact-dialogecqm-add-measurefirebase-autoformfile-list-componentlive-localizermaterial-components-elm-js-importsmicro-fabric-uxmumaa-dialogh2-elementsisu-elementisu-elementsisuwang-elementshomeassistant-frontend-racelandoe-dateoe-date-rangeoe-component-manageroe-data-tableoe-workflow-ui-componentspk-bonnie-testmeasurepk-ecqm-headerpk-ecqm-login@hatiolab/things-shellct-polymer-simple-text-menu@kano/code@kano/kwc-blockly@kano/web-components@kubex/cube-dialogunity-core-betavowo-submenu-dialog@mistio/polyana-dashboard@mistio/timerange-picker@neogrup/nc-discount-dialog@neogrup/nc-doc@neogrup/nc-docw@neogrup/nc-password-dialog@neogrup/nc-search@neogrup/nc-simple-dialog@neogrup/nc-zone-map@neogrup/nc-confirmation-dialog@neovici/cosmoz-dialog@operato/color-picker@nuskin/ns-account-elements@nuskin/ns-dev-portal@nuxeo/nuxeo-ui-elements@myfrom/notifier@lrnwebcomponents/elmsln-apps@lrnwebcomponents/game-show-quiz@lrnwebcomponents/haxcms-elements@lrnwebcomponents/lrndesign-contentsequencer@lrnwebcomponents/lrnapp-studio@lucentray/pine-web-components@elifent/paper-datepicker@sdl-web/sdl-dialog@rwestlund/responsive-dialog@rwth-acis/las2peer-project-service-frontend@firefly-elements/firefly-dialog@firefly-elements/firefly-login@vic10us/wistia-video@vowo/vowo-submenu-dialog@feezal/feezal-element-paper-dialog@teipublisher/pb-components@exmg/exmg-form-drawer@exmg/test-exmg-dialogs@exmg/exmg-dialogs@shifang2013/log-in@ez-webcomponents/ez-data-drilldown@sibley/myuw-app-bar@uxland/ui-interaction@uxland/uxl-interaction@things-factory/operato-bpms@things-factory/modeller-ui@things-real/shell@things-shell/real-modeller@things-shell/board-modeller@advanced-rest-client/websocket-data-view@advanced-rest-client/arc-data-settings-panel@01ht/ht-wysiwyg@01ht/ht-item-editor@01ht/ht-organization-editoradd-measure@anviltech/wuf-poly-paper-elements@aspen-elements/firefly-login@aspen-elements/paper-bottom-sheet@aspen-elements/aspen-nav-menu@casper2020/casper-common-ui@cwmr/paper-searchcontact-dialog
3.0.1

6 years ago

3.0.0

6 years ago

3.0.0-pre.26

6 years ago

3.0.0-pre.25

6 years ago

3.0.0-pre.24

6 years ago

3.0.0-pre.23

6 years ago

3.0.0-pre.22

6 years ago

3.0.0-pre.21

6 years ago

3.0.0-pre.20

6 years ago

3.0.0-pre.19

6 years ago

3.0.0-pre.18

6 years ago

3.0.0-pre.17

6 years ago

3.0.0-pre.16

6 years ago

3.0.0-pre.15

6 years ago

3.0.0-pre.14

6 years ago

3.0.0-pre.13

6 years ago

3.0.0-pre.12

6 years ago

3.0.0-pre.11

6 years ago

3.0.0-pre.10

6 years ago

3.0.0-pre.8

6 years ago

3.0.0-pre.7

6 years ago

3.0.0-pre.6

6 years ago

3.0.0-pre.4

6 years ago

3.0.0-pre.3

6 years ago

3.0.0-pre.2

6 years ago

3.0.0-pre.1

7 years ago

1.1.0-pre.3

7 years ago

1.1.0-pre.2

7 years ago

1.1.0-pre.1

7 years ago

0.0.4

7 years ago

0.0.3

8 years ago

0.0.1

8 years ago