TrademarkTrademarkDocs
Ctrl k
Search docs...
Contexts

LayoutProvider

Updated: July 27, 2026
View on GitHub
The LayoutProvider component is a context provider that creates a listener for the Flex and Grid components to track window size. Wrap your app with LayoutProvider. You can pass a breakpoint object to the LayoutProvider.
Prop
Type
Default
children
React.ReactNode—
breakpoints
{ xs?: number; s?: number; m?: number; l?: number; xl?: number }—
useLayout() reads the resolved breakpoint state. Use it when a decision cannot be expressed with the responsive props — mounting a different component per breakpoint, say, rather than styling one. It throws outside a LayoutProvider. width is 0 on the server and on the first client render, so branch on it only inside an effect — or branch on currentBreakpoint, which is resolved before paint.
Returns
Type
Default
currentBreakpoint
The breakpoint the viewport currently sits in.
xssmlxl
—
width
Viewport width in pixels. 0 until measured.
number0
breakpoints
The active breakpoint map.
Record<BreakpointKey, number>DEFAULT_BREAKPOINTS
isBreakpoint
True when the viewport is exactly at that breakpoint.
(key: BreakpointKey) => boolean—
maxWidth
True at or below that breakpoint.
(key: BreakpointKey) => boolean—
minWidth
True at or above that breakpoint.
(key: BreakpointKey) => boolean—
isDefaultBreakpoints
True when no custom breakpoints were supplied.
() => boolean—
Exported so a custom map can be derived from it rather than retyped.
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club