Opening a layer is considered navigation by default.
let layer = await up.layer.open({ url: '/contacts' })
console.log(layer.mode) // logs "modal"
All render options may be used.
You may configure default layer attributes in up.layer.config
.
Whether to stack the new overlay or replace existing overlays.
The kind of overlay to open.
The size of the overlay.
Supported values are 'small'
, 'medium'
, 'large'
and 'grow'
:
See overlay sizes for details.
An optional HTML class for the overlay's container element.
See overlay classes.
How the overlay may be dismissed by the user.
Supported values are 'key'
, 'outside'
and 'button'
.
See customizing dismiss controls
for details.
You may enable multiple dismiss controls by passing an array or a space-separated string.
Passing true
or false
will enable or disable all dismiss controls.
Whether the overlay has visible history.
If set to true
the overlay location, title and meta tags will be shown
while the overlay is open. When the overlay is closed, the parent layer's history is restored.
If set to 'auto'
history will be visible if the initial overlay
content matches a main target.
If set to false
, fragments changes within the overlay will never update the address bar.
You can still access the overlay's current location using up.layer.location
.
See History in overlays.
The opening animation.
The link element that caused this overlay to open.
The origin will be re-focused when the overlay closes.
A function that is called when the overlay was inserted into the DOM.
The function argument is an up:layer:opened
event.
The overlay may still play an opening animation when this function is called.
To be called when the opening animation is done, pass an
{ onFinished }
option.
A function that is called when the overlay was accepted.
The function argument is an up:layer:accepted
event.
A function that is called when the overlay was dismissed.
The function argument is an up:layer:dismissed
event.
One or more event types that will cause this overlay to automatically be accepted when a matching event occurs within the overlay.
The overlay result value is the event object that caused the overlay to close.
One or more event types that will cause this overlay to automatically be dismissed when a matching event occurs within the overlay.
The overlay result value is the event object that caused the overlay to close.
One or more URL patterns that will cause this overlay to automatically be accepted when the overlay reaches a matching location.
The overlay result value is an object of named segments matches captured by the URL pattern.
One or more URL patterns that will cause this overlay to automatically be dismissed when the overlay reaches a matching location.
The overlay result value is an object of named segments matches captured by the URL pattern.
The position of the popup relative to the { origin }
element that opened
the overlay.
Supported values are 'top'
, 'right'
, 'bottom'
and 'left'
.
See popup position.
The alignment of the popup within its { position }
.
Supported values are 'top'
, 'right'
, 'center'
, 'bottom'
and 'left'
.
See popup position.
A promise for the up.Layer
object that models the new overlay.
The promise will be resolved once the overlay was placed into the DOM.