Skip to content

Getting Started

Installation

Terminal window
npm install @haebaragi/better-dialog

Basic Usage

1. Write the HTML

<button data-better-dialog-show="my-dialog">Open Dialog</button>
<dialog id="my-dialog">
<p>Hello, world!</p>
<button data-better-dialog-close>Close</button>
</dialog>

2. Initialize with JavaScript

import { BetterDialog } from '@haebaragi/better-dialog';
new BetterDialog('#my-dialog');

That’s it — you now have a working modal, powered by the native <dialog> element.