useDockPosition
The screen edge an AppDock is pinned to. The viewport dock shares one persisted edge; a dock scoped to a container gets its own with createDockPosition.
Install: pnpm add-composable useDockPosition
Moving the viewport dock
Any component can move the dock. AppDock animates the change itself.
A dock inside a container
Pass an independent position so the container dock does not move the page one.
API
useDockPosition((storageKey?: string) => DockPositionApi): Shared edge, persisted to localStorage under the key. Every call with the same key returns the same state.createDockPosition((initial?: DockPosition) => DockPositionApi): An independent edge that is not persisted, for several docks on one page.dockPosition(Ref<'bottom' | 'left' | 'right' | 'top'>): The current edge. Physical, not logical: it does not flip under RTL.setDockPosition((value: DockPosition) => void): Move to an edge.cycleDockPosition((allowed?: readonly DockPosition[]) => void): Walk to the next edge, going round the screen (bottom, left, top, right) and skipping any not allowed.resetDockPosition(() => void): Back to the default edge, clearing the stored value.