The LayoutProvider component is a context provider that creates a listener for the Flex and Grid components to track window size, and installs the framework adapters that links and images render through.
Wrap your app with LayoutProvider.
In a Next.js app, import LayoutProvider from @once-ui-system/core/next. It is the same provider with the Next adapters installed, so SmartLink, Button/Card/ToggleButton with an href, Media, Logo, MegaMenu and Kbar route through next/link and next/image. The export from the package root installs the plain DOM adapters instead: everything still renders, as a plain <a> and <img>, which is why it is easy to miss. npx once-ui-validate-ai-code flags it.
The breakpoints are fixed since 2.0, so LayoutProvider no longer takes a breakpoints prop. See Breakpoints.
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.
The widths every breakpoint class and useLayout use. Exported for reading; they are not configurable.