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
Signature TypeScript complète extraite du fichier du composable.
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
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- 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
Exemples
Extraits de code prêts à coller.
Read the main content rectangle
Inspect a registered layout item