0.25.0 • Published 4 months ago

qing-overlay v0.25.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

qing-overlay (WIP)

Qing overlay logo

Build Status Pages Status npm version Node.js Version

This component is not production-ready due to this issue.

An overlay component based on the <dialog> element (MDN).

Demo

Demo

Installation

qing-overlay is based on lit.

npm i qing-overlay lit

Usage

A minimal example

<qing-overlay>
  <h2>Title</h2>
  <p>Hello world</p>
</qing-overlay>

Overlay size

Overlay size is fully customizable. By default, height defaults to auto (fits content size), and width defaults to 100vw. You can add custom CSS to fit your use case. Some examples:

/** Example 1 **/
/** 80% of screen width on medium or large screens */
@media (min-width: 768px) {
  qing-overlay::part(dialog) {
    width: 80%;
  }
}

/** Example 2 **/
/** Auto width with min and max values on medium or large screens */
@media (min-width: 768px) {
  qing-overlay::part(dialog) {
    width: auto;
    max-width: min(100vw, 1000px);
    min-width: 400px;
  }
}

/** Example 3 **/
/** Fullscreen dialog with margins **/
qing-overlay::part(dialog) {
  width: calc(100vw - 1rem);
  height: calc(100vh - 1rem);
}
@media (min-width: 768px) {
  qing-overlay::part(dialog) {
    width: calc(100vw - 4rem);
    height: calc(100vh - 4rem);
  }
}

Attributes

  • open: boolean indicates whether the overlay is visible.
  • closeOnEsc: boolean true if the overlay should be closed when Esc is down. Defaults to false.

Events

  • overlay-open: fires when an overlay is opened.
  • overlay-close: fires when an overlay is closed.
  • overlay-dismiss: fires when an overlay is being dismissed (still visible).
  • overlay-esc-down: fires when ESC key is pressed.

CSS Shadow Parts

  • dialog the internal <dialog> element.

CSS Variables

  • --overlay-backdrop-background CSS background value of dialog backdrop.
  • --overlay-animation-duration background fade-in animation duration.
0.25.0

4 months ago

0.24.0

4 months ago

0.23.0

5 months ago

0.21.0

2 years ago

0.20.0

2 years ago

0.21.10

2 years ago

0.22.2

2 years ago

0.22.1

2 years ago

0.22.0

2 years ago

0.15.0

2 years ago

0.14.0

2 years ago

0.13.2

3 years ago

0.13.1

3 years ago

0.13.0

3 years ago

0.12.0

3 years ago

0.12.1

3 years ago

0.11.4

3 years ago

0.11.3

3 years ago

0.11.2

3 years ago

0.11.1

3 years ago

0.11.0

3 years ago