Reference

createDrawer(options?)

Create one independent drawer. Omitting id allocates a unique id; duplicate explicit ids throw. Keep the returned controller and call update() for later changes.

Signature

function createDrawer(options?: VanillaDrawerOptions): VanillaDrawerController

Description

Creation registers one owned instance. Pass open: true to start visible, or use its trigger or setOpen(true) later. Keep the returned controller for updates and cleanup. A failed initial content factory rolls back registration and partial DOM.

Returns

An owned controller; see its methods and terminal disposal contract.

Example

import { createDrawer } from '@samline/drawer'

const drawer = createDrawer({ title: 'Filters', content: 'Choose your filters' })
drawer.setOpen(true)
drawer.update({ content: 'Ready to apply' })
drawer.destroy()