A lightweight React component to help developers visualize and debug Tailwind CSS breakpoints during development.
Tested with Vite and Next.js.
Before installing, check which Tailwind version you're using β setup differs between Tailwind v3 and v4.
xs
, sm
, md
, lg
, xl
, 2xl
3xl
, 4xl
(see setup instructions below)Using npm:
npm install tailwind-breakpoint-debugger
Or with yarn:
yarn add tailwind-breakpoint-debugger
Import and include the component in your app:
import BreakpointDebugger from 'tailwind-breakpoint-debugger';
function MyApp() {
return (
<>
{/* Your app components */}
<BreakpointDebugger />
</>
);
}
You can optionally show only specific breakpoints:
<BreakpointDebugger breakpoints={['xs', 'md', 'lg']} />
This package works out of the box with Next.js + Tailwind v3, as long as you add the package to your Tailwind content
array:
// tailwind.config.js
module.exports = {
content: [
'./src/**/*.{js,ts,jsx,tsx}',
'node_modules/tailwind-breakpoint-debugger/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
screens: {
// Use rem for consistency
'3xl': '122.5rem', // 1960px
'4xl': '160rem', // 2560px
},
},
},
plugins: [],
}
And donβt forget to include Tailwind layers in your global CSS:
/* styles/globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
As Tailwind v4 uses a CSS-first configuration model, there is different setup you need to put in your global.css
file. Also, you will need to create and use tailwind.config.js
, regardless of version with Next.js:
@import "tailwindcss";
@config "../tailwind.config.js";
Everything else remains the same as with v3 setup.
This method only works with Vite, as
@source
is currently not supported by Next.js.
Tailwind v4 supports a CSS-first configuration model. You no longer need tailwind.config.js
unless you're using advanced features.
Instead, define breakpoints directly in your global CSS:
/* global.css or whatever CSS file you're using */
@import "tailwindcss";
@source "../node_modules/tailwind-breakpoint-debugger"; /* Required to scan the package */
@theme {
/* Use rem to avoid overlapping breakpoint ranges */
--breakpoint-3xl: 122.5rem; /* 1960px */
--breakpoint-4xl: 160rem; /* 2560px */
}
MIT License
Hey there! This is my first package on npm, and while itβs built to help fellow developers get started more easily, I understand that things donβt always work perfectly.
If you run into any bugs, have questions, or just want to share feedback or suggestions β Iβd genuinely appreciate it. Donβt hesitate to reach out! Also if you have any cool open-source project ideas, feel free to share them with me :)
Contact me on:
In case of problems with code:
Thanks for using Tailwind Breakpoint Debugger! π
Keywords: tailwind, next.js, react, breakpoint, debugger, tailwindcss, vite, tailwind v4, tailwind v3