Tailwind Indicator

Shows the active Tailwind CSS breakpoint during development.

Resize the window: the badge shows the active breakpoint.

xs
import { TailwindIndicator } from "@/components/ui/tailwind-indicator"

export function TailwindIndicatorDemo() {
  return (
    // O `transform` prende o indicador (que é `fixed`) dentro desta caixa,

Installation

pnpm slabui add tailwind-indicator

Usage

Render it once in the root layout. It is a small fixed badge in a corner of the window with the name of the active breakpoint (xs, sm, md, lg, xl, 2xl, 3xl, 4xl).

app/layout.tsx
import { TailwindIndicator } from "@/components/ui/tailwind-indicator"
 
export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <TailwindIndicator />
      </body>
    </html>
  )
}

By default it renders nothing in production: it reads NODE_ENV (or the MODE of Vite) and hides itself when the value is production.

Position

Use position to move the badge to another corner.

<TailwindIndicator position="top-right" />

Always visible

Use always to show the badge in production too, for example in a staging environment.

<TailwindIndicator always />

API Reference

PropTypeDefault
position"top-left" | "top-right" | "bottom-left" | "bottom-right""bottom-left"
alwaysbooleanfalse