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

@3mo/dialog

v0.8.6

Published

Web components for modal dialogs and application pages with a heading, actions and sizes, built on Material Web.

Readme

Dialog

Web components for modal dialogs and application pages with a heading, actions and sizes, built on Material Web.

npm Documentation

A modal dialog with a heading, content and actions, usually rendered by a dialog component.

Installation

npm install @3mo/dialog
import '@3mo/dialog'

Usage

<mo-button type='outlined' @click=${() => setOpen(true)}>Discard draft</mo-button>
<mo-dialog heading='Discard draft?' primaryButtonText='Discard' secondaryButtonText='Keep editing'
	?open=${open}
	@openChange=${(event: CustomEvent<boolean>) => setOpen(event.detail)}
>
	The draft and its attachments will be deleted.
</mo-dialog>

Examples

  • Sizes — small, medium and large set the width, and large also fills the height; without a size the dialog fits its content.
  • Scrollable — Content taller than the window scrolls between the header and the footer, and a select field's options still open over it.
  • Action Slots — The primaryAction and secondaryAction slots take buttons of your own in place of the button texts.
  • Header Actions — The action slot adds to the header, before the close button.
  • Footer — The footer slot fills the footer beside the actions.
  • Blocking — A blocking dialog has no close button and ignores Escape and the backdrop, so only one of its actions closes it.
  • Auto Focus — The field marked autofocus takes the focus as the dialog opens.
  • Bound To Window — Opened in a tab of its own, as "Open as Tab" in the header does, a dialog is laid out as a page filling the window.
  • Custom Properties — The host's background colors the surface, and custom properties color the heading, the content and the backdrop.
  • Parts — The header, heading, content and footer parts can be styled from outside.
  • Dialog Component — An application writes a dialog as a component whose template holds the mo-dialog, and confirm() opens it.
  • Fetchable Dialog — A mo-fetchable-dialog in a FetchableDialogComponent stays loading until the entity of the given id is fetched.
  • Split Button Action — A split button can be the primary action: its main button spins while the action runs, and its menu offers variants.

Accessibility

A native modal dialog, built on the Material Web dialog, so the page behind it is inert and Tab stays inside. It is named by its heading, rendered as an h2, and the element with autofocus inside takes focus as it opens.

| Key | Does | | --- | --- | | Escape | Cancels, unless the dialog is blocking: a dialog of its own closes and fires openChange, one in a dialog component runs the component's cancellation. | | Enter | Runs the primary action, with primaryOnEnter. |

API

mo-dialog

Properties

| Name | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | size | size | DialogSize \| undefined | | small, medium or large. Without one, the dialog fits its content. | | blocking | blocking | boolean | false | Hides the close button and ignores Escape and the backdrop, so that only an action closes the dialog. | | primaryButtonText | primaryButtonText | string \| undefined | | The text of the default primary button. | | secondaryButtonText | secondaryButtonText | string \| undefined | | The text of the default secondary button. | | open | open | boolean | false | Whether the dialog is open. | | handleAction | | (key: DialogActionKey) => void \| Promise<void> | | Called with the action taken: primary, secondary or cancellation. A dialog component sets it; without one, the dialog closes itself. | | primaryOnEnter | primaryOnEnter | boolean | false | Runs the primary action when Enter is pressed. | | manualClose | manualClose | boolean | false | Keeps the dialog open after its primary and secondary actions, leaving the closing to them. | | heading | heading | string | "" | The heading in the header. |

Events

| Name | Detail | Description | | --- | --- | --- | | openChange | boolean | Dispatched with the new state whenever the dialog opens or closes. | | pageHeadingChange | string | Dispatched when the dialog heading changes | | requestPopup | void | Dispatched when the dialog is requested to be popped up | | scroll | | |

Slots

| Name | Description | | --- | --- | | (default) | Content of the dialog | | primaryAction | Primary action of the dialog | | secondaryAction | Secondary action of the dialog | | action | Additional actions of the dialog which are displayed in the header | | footer | Footer of the dialog |

CSS custom properties

| Name | Description | | --- | --- | | --mo-dialog-heading-color | Color of the dialog heading | | --mo-dialog-content-color | Color of the dialog content | | --mo-dialog-backdrop | Background of the dialog backdrop | | --mo-dialog-divider-color | Color of the dialog divider | | --mo-dialog-heading-line-height | Line height of the dialog heading |

CSS parts

| Name | Description | | --- | --- | | dialog | The native dialog element. | | header | The header, holding the heading and the header actions. | | heading | Dialog heading | | content | Dialog content | | footer | The footer, holding the actions and the footer slot. |

mo-page

Properties

| Name | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | heading | heading | string | "" | The page heading | | fullHeight | fullHeight | boolean | false | Whether the page should take up the full height of the viewport | | headerHidden | headerHidden | boolean | false | Whether the page header should be hidden |

Events

| Name | Detail | Description | | --- | --- | --- | | pageHeadingChange | string | Dispatched when the page heading changes |

Slots

| Name | Description | | --- | --- | | (default) | The page content | | heading | The page heading | | action | The page action |

CSS parts

| Name | Description | | --- | --- | | header | The page header | | heading | The page heading | | action | The page action |

Links

License

MIT © 3MO GmbH