useLayoutMain

Commons
stable

Reads the nearest OrigamLayout context. Returns the layout item registry accessor, the reactive main content rectangle, and the computed CSS styles that push the main area aside to avoid overlap with fixed layout children (AppBar, Drawer, Footer, BottomNav). Throws if called outside an OrigamLayout provider.

API

Signature

Full TypeScript signature sourced from the composable file.

typescript

useLayout throws "[Origam] Could not find injected layout" when called outside an OrigamLayout. Components that may be used standalone (e.g. in stories) should use useLayoutItem instead, which silently returns inert styles when no layout provider is present.

API

Return values

Properties and methods exposed by the composable return object.

getLayoutItem
Looks up a registered layout item by its id. Returns undefined when the id is not yet registered.
mainRect
Reactive rectangle describing the space left for the main content area after all active layout items have claimed their edges.
mainStyles
CSS styles (left / right / top / bottom + matching --origam-layout---position-* custom properties) to apply to the main content so it never slides under fixed layout panels.
mainId
Stable computed id of the owning OrigamLayout instance.

Usage

Examples

Ready-to-paste usage snippets.

Read the main content rectangle

vue

Inspect a registered layout item

vue