Breakpoints
Responsive breakpoints for building adaptive layouts.
Live demo
Current Breakpoint
defaultBelow Extra Extra Small?
falseBelow Extra Small?
falseBelow Small?
falseBelow Medium?
falseBelow Large?
falseResize your browser window to see the values change in real-time.
Breakpoint values
There are seven breakpoints by default, inspired by common device resolutions:
xs (480px) is wider than most phones, so a class with only an xs: value applies nothing on a phone. Give an unprefixed base value first, then override it at the breakpoint: flex-col xs:flex-row.
useBreakpoint hook
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.
Features
- Performance optimized: Uses a single subscription for all breakpoint changes
- SSR compatible: Returns
defaultduring server-side rendering - Real-time updates: Automatically updates when the viewport size changes
- TypeScript support: Fully typed with autocompletion for all breakpoints
Return value
Returns a Breakpoint type that can be one of: "default", "2xs", "xs", "sm", "md", "lg", "xl", or "2xl".
useIsBelowBreakpoint hook
The useIsBelowBreakpoint hook returns true if the current viewport width is below the specified breakpoint. Perfect for mobile-first responsive design patterns.
Parameters
Accepts a TailwindBreakpoint which can be one of: "2xs", "xs", "sm", "md", "lg", "xl", or "2xl".
Common use cases
- Mobile detection:
useIsBelowBreakpoint("md")for mobile-first layouts - Conditional rendering: Show/hide components based on screen size
- Dynamic styling: Apply different CSS classes for mobile vs desktop
- Component adaptation: Switch between mobile and desktop component variants