Reference

API Reference

API Reference

Every exported function, option, and event in the Docks core package.

May 7, 2026

Written by Sasha Lindqvist

createDock(options)

Creates and mounts an instance. Returns a Dock handle. Throws if the target cannot be resolved.

TypeScriptsignature.ts
1function createDock(options: {
2 target: string | Element
3 theme?: "light" | "dark" | "auto"
4 state?: Record<string, unknown>
5 components?: Registry
6}): Dock

Options

  • target — element or selector to mount into. Required.

  • theme — colour scheme. Defaults to "auto", which follows the OS preference.

  • state — initial store contents. Defaults to an empty object.

  • components — additional components to register beyond the built-ins.

Instance methods

  • dock.render(name, props) — render a registered component into the instance.

  • dock.get(key) — read a value from the store.

  • dock.set(key, value) — write a value and schedule a render.

  • dock.on(event, handler) — subscribe to an instance event. Returns an unsubscribe function.

  • dock.destroy() — tear the instance down and release all listeners.

Events

Instance events fire synchronously in the order listed below. Handlers that throw are logged and skipped; they do not stop the sequence.

  1. mount — the instance has attached to its target.

  2. update — a batched write has been applied.

  3. render — the tree has been committed to the DOM.

  4. destroy — teardown has started.

Type exports

The package ships its own types. Dock, Registry, Selector, and SlotMap are all exported from the package root — there is no separate types entry point.

Create a free website with Framer, the website builder loved by startups, designers and agencies.