Edit this page

up.layer up.layer.open([options])
JavaScript function

Opens a new overlay.

Opening a layer is considered navigation by default.

Example

let layer = await up.layer.open({ url: '/contacts' })
console.log(layer.mode) // logs "modal"

Parameters

[options] Object optional

All render options may be used.

You may configure default layer attributes in up.layer.config.

[options.layer="new"] string optional

Whether to stack the new overlay or replace existing overlays.

See replacing existing overlays.

[options.mode] string optional

The kind of overlay to open.

See available layer modes.

[options.size] string optional

The size of the overlay.

Supported values are 'small', 'medium', 'large' and 'grow': See overlay sizes for details.

[options.class] string optional

An optional HTML class for the overlay's container element.

See overlay classes.

[options.dismissable=true] booleanorstringorArray<string> optional

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.

[options.history] booleanorstring optional

Whether history of the overlay content is visible.

If set to true the overlay location and title will be shown in browser UI.

If set to 'auto' history will be visible if the initial overlay content matches a main target.

[options.animation] stringorFunction optional

The opening animation.

[options.onOpened] Function(Event) optional

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.

[options.onAccepted] Function(Event) optional

A function that is called when the overlay was accepted.

The function argument is an up:layer:accepted event.

[options.onDismissed] Function(Event) optional

A function that is called when the overlay was dismissed.

The function argument is an up:layer:dismissed event.

[options.acceptEvent] stringorArray<string> optional

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.

See Closing when an event is emitted.

[options.dismissEvent] stringorArray<string> optional

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.

See Closing when an event is emitted.

[options.acceptLocation] stringorArray<string> optional

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.

See Closing when a location is reached.

[options.dismissLocation] stringorArray<string> optional

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.

See Closing when a location is reached.

[options.context={}] Object optional

The initial context object for the new overlay.

[options.position] string optional

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.

[options.align] string optional

The alignment of the popup within its { position }.

Supported values are 'top', 'right', 'center', 'bottom' and 'left'.

See popup position.

Return value

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.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more