- Docs
- API reference
API reference
The v5 public API: one drawer factory, owned controller methods, explicit registry queries, group cleanup and optional headless state.
Start with createDrawer() and keep its controller. All loading modes expose this same API; a framework does not require a different factory.
Factory
createDrawer(options?)creates one independent DOM drawer. An explicit id must be unique.
Controller
setOpen, update, setActiveSnapPoint, getSnapshot, subscribe and destroy cover the instance lifecycle. See Controller and registry for their exact return values and cleanup.
Inspectors
getDrawer(id)returns the exact registered controller or null.getDrawers()returns all registered controllers keyed by id.getParentDrawer(id)returns a parent or null.getChildDrawers(id)returns child controllers.
Lifecycle contract
Creation registers an instance and mounts its persistent host. Opening mounts its visual subtree; closing releases modal effects and removes visual nodes after exit while preserving the instance. destroy() removes the instance, host, listeners and timers, clears subscriptions and makes the handle terminal. destroyDrawers() disposes the complete registry. One controller’s cleanup must not release another owner’s modal effects.
Headless
createDrawerController(options?) creates observable state without a DOM or registry entry. Use it for an alternative renderer or state-only integration.
Changes from v4
The aliases and implicit id-based mutators were removed. Look up an existing controller, then call its instance methods. The changelog lists every breaking change and replacement. Historical method URLs remain migration notes.