useBreakpoint reads the current responsive breakpoint from BreakpointCtx (populated by BreakpointProvider) and exposes helper predicates for comparing it against the breakpoint scale.
The breakpoint scale comes from breakpoints in css ({ xs: 0, sm: 640, md: 768, lg: 1024, xl: 1280 }), ordered xs < sm < md < lg < xl.
BreakpointProviderNot exported. src/breakpoint/index.ts exports BreakpointProvider, but xanui-core's package entry (src/index.ts) only re-exports useBreakpoint and useBreakpointProps from that folder — BreakpointProvider itself is internal. AppRoot is the only supported way to mount it.
tsx
// internal shape, for reference only — not importable from 'xanui-core'<BreakpointProvider defaultKey="xl">{children}</BreakpointProvider>On mount, the provider evaluates matchMedia queries built from the breakpoints scale, stores the resolved breakpoint in a xuibp cookie, and keeps state in sync as the viewport crosses breakpoints (via change listeners on each media query).
AppRoot renders a BreakpointProvider around its children, seeded from its own defaultBreakpoint prop (falling back to "xl") — use that prop rather than trying to import BreakpointProvider directly.
useBreakpoint()Returns:
tsx
import { Tag, useBreakpoint } from 'xanui-core' const ResponsiveSidebar = () => { const bp = useBreakpoint() const collapsed = bp.isDown('lg') return ( <Tag component="aside" width={collapsed ? : } transition="width 200ms ease" px={collapsed ? : } > {collapsed ? <IconMenu /> : <FullMenu />} </Tag> )}tsx
const bp = useBreakpoint() if (bp.isBetween('sm', 'lg')) { // sm or md, but not lg/xl}Wrap your tree with <BreakpointProvider defaultKey="..."> (or use <AppRoot>, which does this for you) to activate the context. Without a provider, value will be undefined and the predicates will compare against an index of -1.