mirror of https://github.com/hashicorp/consul
5fb9df1640
* Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
README.mdx | ||
index.hbs | ||
index.js | ||
index.scss | ||
layout.scss | ||
skin.scss |
README.mdx
--- class: ember --- # ModalDialog Consul UIs modal component is a thin wrapper around the excellent `a11y-dialog`. The most common usage will be something like the below: ```hbs preview-template <ModalDialog @onclose={{noop}} @onopen={{noop}} @aria={{hash label="Screenread name of the modal" }} as |modal|> <!-- Save a reference to the modal component so we can call its methods --> {{did-insert (set this 'modal' modal)}} <BlockSlot @name="header"> <h2> Modal Header </h2> </BlockSlot> <BlockSlot @name="body"> <p> Modal body </p> </BlockSlot> <BlockSlot @name="actions"> <button type="button" {{on "click" modal.close}} > Close modal </button> </BlockSlot> </ModalDialog> <button type="button" {{on 'click' (optional this.modal.open)}} > Open Modal </button> ``` All modals work in tandem with `<ModalLayer />` to render modals. First of all ensure you have a modal layer on the page (it doesn't have to be in the same template) ```hbs <ModalLayer /> ``` Then all modals will be rendered into the `<ModalLayer />`. ## Arguments | Argument | Type | Default | Description | | --- | --- | --- | --- | | `onopen` | `Function` | `undefined` | A function to call when the modal has opened | | `onclose` | `Function` | `undefined` | A function to call when the modal has closed | | `aria` | `Object` | `undefined` | A `hash` of aria properties used in the component, currently only label is supported | | `open` | `Boolean` | `false` | Whether the modal should be initialized in its 'open' state. Useful if the modal should be controlled via handlebars conditionals. Please note this argument it not yet reactive, i.e. it is only checked on component insert not attribute update. An improvement here would be to respect this value during the update of the attribute. | ## Exports | Name | Type | Description | | --- | --- | --- | | `open` | `Function` | Opens the modal dialog | | `close` | `Function` | Closes the modal dialog | | `opened` | `boolean` | Whether the modal is currently open or not |