Try Install Learn Blog API Packages GitHub
Pages
mint-ui

Search
Basic information
Entities
Versions
Dependencies
mint-color 0.9.0 <= v < 1.0.0

Ui.Modal

A generic global modal component.

Some of its features:

  • When open pressing Esc closes it.

  • After opened it will focus the first focusable item (which usually is the close icon).

  • Showing the component returns a promise which is resolved when its closed or rejected when cancelled.

  • The keyboard focus is trapped in the list: Tab and Shift-Tab cycles focusable elements.

  • When closed the focus is returned to the last focused element before opening (which is usually the one that opened the modal).

States

content
:
Html
=
<></>

The content of the modal.

focusedElement
:
Maybe(Dom.Element)
=
Maybe::Nothing

The previously focused element.

open
:
Bool
=
false

Whether or not the modal is open.

resolve
:
Function(Maybe(Void), Void)
=
(value : Maybe(Void)) { void }

The resolve function.

transitionDuration
:
Number
=
240

The transition duration.

zIndex
:
Number
=
900

The z-index of the modal.

Functions

cancel
:
Promise(Void)

Cancels the modal.

hide
:
Promise(Void)

Hides the modal.

render
:
Html

Renders the modal.

show
(
content
:
Html
)
:
Promise(Maybe(Void))

Shows the component with the given content.

showWithOptions
(
content
:
Html
zIndex
:
Number
transitionDuration
:
Number
openCallback
:
Function(Promise(Void))
)
:
Promise(Maybe(Void))

Shows the component with the given content and z-index.