Skip to content

A Tailwind CSS component that shows the active responsive breakpoint per container.

Notifications You must be signed in to change notification settings

vormkracht10/tailwindcss-debug-containers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tailwind CSS Debug Containers 📱

A Tailwind CSS component that shows the currently active container (responsive breakpoint).

Demo

Install

Requires Tailwind v1.0 or higher.

  1. Install the plugin:
npm install tailwindcss-debug-containers --save-dev
  1. Add it to your tailwind.config.js file:
// tailwind.config.js
module.exports = {
  //...
  plugins: [require("tailwindcss-debug-containers")],
};
  1. Add the class debug-containers to your <body> tag:
<body class="debug-containers"></body>

Disable in production

Laravel

<body class="{{ app()->isLocal() ? 'debug-containers' : '' }}">

Craft CMS

<body class="{{ devMode ? 'debug-containers' : '' }}">

Customization

You can customize this plugin in the theme.debugContainers section of your tailwind.config.js file.

Ignore containers

To ignore a specific container (for instance dark mode), add the container name to the ignore configuration array. dark is ignored by default.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      ignore: ["dark"],
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Position

The first item of the position configuration array can be top or bottom, the second item can be left or right.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      position: ["bottom", "left"],
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Styles

Take a look at the index.js file to see all the default styles.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      style: {
        backgroundColor: "#C0FFEE",
        color: "black",
        // ...
      },
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Prefix

Modify the debug label prefix with the prefix configuration option.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      prefix: "container: ",
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Selector

Modify the debug element selector with the selector configuration option.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      selector: ".debug-containers",
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

About

A Tailwind CSS component that shows the active responsive breakpoint per container.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%