Skip to content

API reference ​

Manager ​

MemberReturns
open(target, props?, options?)Promise<Handle>Replaces the namespace stack.
push(target, props?, options?)Promise<Handle>Adds a modal on top of the stack.
prompt<R>(target, props?, options?)Promise<R | null>
pop({ namespace? })Promise<boolean>
closeAll({ namespace? })Promise<boolean>
closeById(id, event?)Promise<boolean>
get(id), current(namespace?), topmost(predicate?)Handle | undefined
getSnapshot(namespace?)NamespaceSnapshotFrozen and stable until something changes.
subscribe(listener)() => voidReturns an unsubscribe function.
configure(options), configureNamespace(name, options)void
register(name, entry), unregister(name), lookup(name)Registry.
attachHost(namespace?), isHosted(namespace?)Used by containers.
reset(), dispose()void

target is a component or a registered name.

Handle ​

Member
id, namespace, component, props, name, isRoute, extraRead-only.
status, closed, revision, timeoutRead-only.
backgroundClose, escClose, draggableRead and write. Changes re-render the modal.
instanceThe rendered component instance (Vue).
close(event?)Promise<boolean>
resolve(value)Promise<boolean>
setProps(props)Replaces the props of the open modal.
resultPromise<R | null>
onBeforeClose(guard), onClosed(listener), on(event, listener)Each returns an unsubscribe function.
emit(event, ...args), eventNames()

createModal options ​

Option
defaultsOptions for every namespace, plus the global beforeOpen.
namespacesOverrides per namespace.
registryNamed modals.
requireHostboolean or (namespace) => boolean. The adapters require a container for default.
guardFromReads a guard from a component. The Vue adapter reads beforeModalClose.

Released under the MIT License.