Skip to content

Xammie/tailwindcss-named-z-index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tailwindcss-named-z-index

Build Status Total Downloads Latest Release License

Note This plugin is still in development

By default, tailwindcss has numbered z-indexes (z-10, z-20, z-30, etc.). This plugin allows you to use named z-indexes instead which have an index based on the position in the array. The first layer in the array will have the highest z-index.

Installation

npm install tailwindcss-named-z-index
# or
yarn add tailwindcss-named-z-index

Usage

// tailwind.config.js
module.exports = {
    theme: {
        zIndexLayers: [
            'header',   // z-index: 30
            'modal',    // z-index: 20
            'dropdown', // z-index: 10
        ]
    },
    plugins: [require('tailwindcss-named-z-index')],
}
<div class="z-header"></div>
<div class="z-sidebar"></div>
<div class="z-dropdown"></div>

Credits

License

The MIT License (MIT). Please see License File for more information.