Breakpoints
Breakpoints allow you to build responsive layouts by reacting to screen size changes.
Breakpoints allow you to build responsive layouts by reacting to screen size changes. Zen uses Tailwind's default breakpoints with a mobile-first approach. Styles are applied from the smallest screen up, and breakpoints specify the minimum width at which styles take effect.
| Breakpoint | Device | Min Width |
|---|---|---|
| base | All devices | 0px |
| sm | Small devices | 640px |
| md | Medium devices | 768px |
| lg | Large devices | 1024px |
| xl | Extra large devices | 1280px |
| 2xl | Extra extra large devices | 1536px |
Usage#
Certain properties of layout components accept a Responsive object, which specifies what value
to apply at a given breakpoint. Use 'base' for the mobile-first value that applies to all screen sizes.
For example, the Heading component takes a size prop. If we pass in a
Responsive object, we can specify which sizes to display at different breakpoints.
This text will shrink/grow as the screen resizes.
useBreakpoint Hook#
The useBreakpoint hook returns the current breakpoint based on screen width.
