@lion/dialog v0.16.1
Interaction >> Dialog >> Overview ||10
A web component that wraps a modal dialog controller. Its purpose is to make it easy to use our Overlay System declaratively.
import { html } from '@lion/core';
import '@lion/dialog/define';
import { demoStyle } from './src/demoStyle.js';export const main = () => html`
<style>
${demoStyle}
</style>
<lion-dialog>
<button slot="invoker">Click me to open dialog</button>
<div slot="content" class="dialog">
Hello! You can close this dialog here:
<button
class="close-button"
@click=${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}
>
⨯
</button>
</div>
</lion-dialog>
`;Features
- Show content when clicking the invoker
- Respond to close event in the slot="content" element, to close the content
- Have a
.configobject to set or update the OverlayController's configuration
Installation
npm i --save @lion/dialogimport { LionDialog } from '@lion/dialog';
// or
import '@lion/dialog/define';- Your
slot="content"node will be moved to the global overlay container during initialization. After, your content node is no longer a child oflion-dialog. If you still need to access it from thelion-dialogyou can do so by using the._overlayContentNodeproperty. - To close the overlay from within the content node, you need to dispatch a
close-overlayevent that bubbles. It has to be able to reach the content node. - If you need to traverse shadow boundaries, you will have to add
composed: trueas well, although this is discouraged as a practice.
Changing the configuration
You can use the config property on the dialog to change the configuration.
The documentation of the full config object can be found in the lion/overlay package or here in Overlay System - Configuration.
The config property uses a setter to merge the passed configuration with the current, so you only overwrite what you pass when updating config.
2 years ago
2 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago