Responsive breakpoints for building adaptive layouts.
defaultfalsefalsefalsefalsefalseResize your browser window to see the values change in real-time.
There are seven breakpoints by default, inspired by common device resolutions:
The useBreakpoint hook returns the current breakpoint based on the viewport width. It efficiently tracks all breakpoints and returns the largest one that currently matches.
1import { useBreakpoint } from "@ngrok/mantle/hooks";2 3function ResponsiveComponent() {4 const breakpoint = useBreakpoint();5 6 return (7 <div>8 <p>Current breakpoint: {breakpoint}</p>9 {breakpoint === "lg" && <p>This only shows on large screens and above!</p>}10 </div>11 );12}default during server-side renderingReturns a Breakpoint type that can be one of: "default", "2xs", "xs", "sm", "md", "lg", "xl", or "2xl".
The useIsBelowBreakpoint hook returns true if the current viewport width is below the specified breakpoint. Perfect for mobile-first responsive design patterns.
1import { useIsBelowBreakpoint } from "@ngrok/mantle/hooks";2 3function ResponsiveSidebar() {4 const isMobile = useIsBelowBreakpoint("md");5 6 return (7 <aside className={isMobile ? "mobile-sidebar" : "desktop-sidebar"}>8 {isMobile ? <MobileNav /> : <DesktopNav />}9 </aside>10 );11}Accepts a TailwindBreakpoint which can be one of: "2xs", "xs", "sm", "md", "lg", "xl", or "2xl".
useIsBelowBreakpoint("md") for mobile-first layouts