New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

z-indexify

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

z-indexify

A sane way to manage CSS z-indexes

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

Z-Indexify

NPM Build Status Codecov Bundle Size Known Vulnerabilities CodeFactor OpenSSF Scorecard MIT License

A sane way to manage CSS z-indexes across application

Works with Styled Components and TailwindCSS

Table of Contents

  • Install
  • Usage
  • API

Install

# NPM
npm install --save z-indexify

# Yarn
yarn add z-indexify

Usage

With Styled Components

// In your theme.ts used on ThemeProvider
import { zIndexify } from 'z-indexify';

const zIndex = zIndexify(['header', 'overlay', 'sidebar']);
const theme = {
  // others...
  zIndex,
};

// And on Styled
const Header = styled.header`
  z-index: ${({ theme }) => theme.zIndex.header}; /** z-index: 100; */
`;

With TailwindCSS

// In your tailwind.config.ts
import type { Config } from 'tailwindcss';
import { zIndexify } from 'z-indexify';

const zIndex = zIndexify(['header', 'overlay', 'sidebar'], {
  minIndex: 500,
});

const config: Config = {
  content: [...],
  theme: {
    extend: {
      // ...your configs
      zIndex,
    }
  },
};

export default config;

image

API

  • zIndexify(labels[, options]])

    • labels
      • Type: array
      • Name of your z-indexes in asc order.
      • To change order values, simple reorder the array values. e.g.:
        ['foo', 'bar', 'baz'] //=> foo: 100, bar: 101, baz: 102
        ['bar', 'baz', 'foo'] //=> bar: 100, baz: 101, foo: 103
        
    • options
      • Type: object
      • Configuration options if you need
  • options

    ParamTypeDescriptionDefaulte.g.
    minIndexnumberIndex starts of100{ minIndex: 300 } starts with: z-index: 300
    inversebooleanInvert array values orderfalse['foo', 'bar'] will produce: { foo: 101, bar: 100 }
    stepnumberThe gap between number1{ step: 10 } creates: { 100, 110, 120, 130, ... }

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

z-index

FAQs

Package last updated on 05 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts