Try Install Learn Blog API Packages GitHub
Pages
mint-ui

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

Ui.Modal

A generic global modal component.

Some of it's 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 usally 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.

reject
:
Function(Ui.Modal.Cancelled, Void)
=
(error : Ui.Modal.Cancelled) { void }

The reject function.

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

The resolve function.

transitionDuration
:
Number
=
240

The transition duration.

zIndex
:
Number
=
900

The z-index of the modal.

Functions

cancel
:
Promise(Never, Void)

Cancels the modal.

hide
:
Promise(Never, Void)

Hides the modal.

render
:
Html

Renders the modal.

show
(
content
:
Html
)
:
Promise(Ui.Modal.Cancelled, Void)

Shows the component with the given content.

showWithOptions
(
content
:
Html
zIndex
:
Number
transitionDuration
:
Number
openCallback
:
Function(Promise(Never, Void))
)
:
Promise(Ui.Modal.Cancelled, Void)

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