Modal Examples

The recommended method is using the HTML `<dialog>` element for its accessibility and native browser support.

Dialog Modal

Opens with a JS helper and closes natively thanks to a `Button` with `isNativeSubmit: true` inside a `<form method="dialog">`.

Dialog modal that closes when clicked outside

A second `<form method="dialog">` with the `modal-backdrop` class is used. The button inside is required for it to function.

Dialog modal with a close button at the corner

The close button uses `isNativeSubmit: true` and is placed inside its own `<form method="dialog">`.

Dialog modal with custom width

Apply `deepyr` `Size` utilities directly to the `ModalBox`'s `style` property.

Responsive Dialog Modal

Use the `.at(Breakpoint)` fluent API on `Modal` placement modifiers to change its position based on screen size.