---
url: /reference/items/Dialog/js-api.md
---
# JS API
## Options
### `modal`
* Type: `Boolean`
* Default: `true`
Open the dialog as a true modal with [`showModal()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal): the platform then handles the focus trap, makes the rest of the page [`inert`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert), restores focus on close and paints the dialog in the top layer. Set it to `false` (via `data-option-no-modal`) to use [`show()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/show) instead, which keeps the rest of the page interactive (useful for a slide-in nav).
```html {2}
```
### `trapFocus`
* Type: `Boolean`
* Default: `true`
Trap the tabulation inside the dialog. This is **only meaningful on the non-modal path** (`modal: false`): `showModal()` already traps focus natively, so the option is a no-op when `modal` is `true`. On the non-modal path it saves the active element on open, keeps Tab inside the dialog while open, and restores focus on close.
```html {3}
```
### `scrollLock`
* Type: `Boolean`
* Default: `true`
Lock the scroll on the document element while the dialog is open by toggling `document.documentElement.style.overflow`. Set it to `false` with `data-option-no-scroll-lock` to leave the page scrollable.
## Properties
### `dialog`
* Type: `HTMLDialogElement`
A getter returning the native `