npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@outbook/webcomponents-modal-dialog

v1.1.1

Published

Web components modal-dialog

Downloads

195

Readme

@outbook/webcomponents-modal-dialog

This package provides a modal dialog component with two built-in layouts:

  • content: full-screen content dialog
  • message: centered message dialog with veil

The package is intended to be used through the ModalDialog() wrapper, which creates, renders, and removes the dialog for you.

Installation

npm install @outbook/webcomponents-modal-dialog

Usage

Content Dialog

import { html } from 'lit';
import { ModalDialog } from '@outbook/webcomponents-modal-dialog';

function openExampleModal(ev) {
  ModalDialog({
    origin: ev.currentTarget.id,
    title: 'Example modal',
    type: 'content',
    view: ({ closeDialog }) => html`
      <p>This is the content of the modal dialog.</p>
      <button @click="${closeDialog}">Close</button>
    `
  });
}

function render() {
  return html`
    <button id="open-modal" @click="${openExampleModal}">Open modal</button>
  `;
}

Message Dialog With Actions

import { html } from 'lit';
import { ModalDialog } from '@outbook/webcomponents-modal-dialog';

const saveAction = ({ detail }) => {
  console.log('button interaction:', detail.originalEvent.type);
};

function openMessageModal(ev) {
  ModalDialog({
    origin: ev.currentTarget.id,
    title: 'Confirm action',
    type: 'message',
    view: () => html` <p>Do you want to save your changes?</p> `,
    actions: [
      {
        text: 'Save',
        type: 'positive',
        eventFn: saveAction
      },
      {
        text: 'Cancel',
        type: 'neutral',
        handler: 'close'
      }
    ]
  });
}

API

ModalDialog(props)

Creates and renders an outbook-modal-dialog.

| Property | Type | Default | Description | | ----------------- | ---------- | ----------- | -------------------------------------------------------------------------------------------------------- | | origin | String | undefined | Id of the element that opened the dialog. Focus is returned to this element when the dialog closes. | | title | String | undefined | Dialog title shown in the header. | | type | String | 'content' | Dialog layout. Supported values are 'content' and 'message'. | | view | Function | null | Function that returns the dialog body. Receives { closeDialog }. | | tabs | Array | [] | Tab configuration passed to @outbook/webcomponents-tabs. If present, it is rendered instead of view. | | hasScroll | Boolean | true | Enables scrolling for content dialogs. Ignored for message dialogs and for dialogs with tabs. | | actions | Array | [] | Footer button configuration. | | portalWrapperId | String | null | Optional container element id for rendering the dialog portal. Defaults to document.body. | | content | Function | undefined | Optional fallback slot content renderer used internally by the component. |

actions

Each action item supports the following properties:

| Property | Type | Default | Description | | --------- | ---------- | ----------- | --------------------------------------------------------------------------------- | | text | String | undefined | Button label. | | type | String | 'neutral' | Visual variant. Supported values are 'neutral', 'positive', and 'negative'. | | handler | String | undefined | Name of an internal dialog handler. Currently close is supported. | | eventFn | Function | () => {} | Handler for the button button-interaction event when no handler is defined. |

Action handler resolution order:

  1. handlers[handler]
  2. eventFn
  3. empty function

When handler: 'close' is used, the dialog closes and focus returns to origin.

Component

outbook-modal-dialog

This is the underlying custom element used by ModalDialog(). It is not usually instantiated directly, because the wrapper manages portal rendering, lifecycle, keyboard handling, and focus return.

Styling

The component uses Shadow DOM and exposes styling hooks through CSS custom properties.

Custom Properties

| Custom Property | Description | | --------------------------------------------------- | -------------------------------------------------------- | | --outbook-modal-dialog--veil-color | Veil color behind the dialog. Used by message dialogs. | | --outbook-modal-dialog--neutral-background | Background color for neutral action buttons. | | --outbook-modal-dialog--neutral-background-hover | Hover background color for neutral action buttons. | | --outbook-modal-dialog--positive-background | Background color for positive action buttons. | | --outbook-modal-dialog--positive-background-hover | Hover background color for positive action buttons. | | --outbook-modal-dialog--negative-background | Background color for negative action buttons. | | --outbook-modal-dialog--negative-background-hover | Hover background color for negative action buttons. |

The dialog also forwards --outbook-scrollable--indicator-max-width internally for the scrollable content area.

Notes

  • type: 'content' renders a full-screen dialog layout.
  • type: 'message' renders a centered dialog with a veil overlay.
  • The close button responds to mouse click, Enter, and Space.
  • Escape closes the dialog.

License

This component is licensed under the Apache-2.0 License.