1.0.7 • Published 5 months ago

grid-debug-overlay v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Grid Overlay

Show an overlay on top of your website to debug positioning elements in your css-grid.

Install the package

npm install grid-debug-overlay --save-dev

…or

yarn add grid-debug-overlay --dev

Import and initialize it:

import GridOverlay from "grid-debug-overlay"
new GridOverlay()

To make sure you only see the overlay in development, you can use the NODE_ENV variable:

if (process.env.NODE_ENV === "development") {
  new GridOverlay()
}

Options

OptionTypeDefaultDescription
gridClassstringgridThe name of a css class that defines your grid
columnPropstring--grid-columnsThe name of a css custom prop that defines the number of columns

Example

:root {
  --my-grid-columns: 6;
  --my-grid-margin: 10px;
  --my-grid-gap: 6px;
}

@media (min-width: 768px) {
  :root {
    --my-grid-columns: 24;
    --my-grid-gap: 8px;
  }
}

.my-grid {
  display: grid;
  grid-column-gap: var(--my-grid-gap);
  grid-template-columns: repeat(var(--my-grid-columns), minmax(0, 1fr));
  max-width: 100%;
  margin: 0 10px;
}
import GridOverlay from "grid-debug-overlay"
new GridOverlay({
  gridClass: "my-grid",
  columnProp: "--my-grid-columns",
})

Todo

Specify options as object with 'columns', 'gap', 'margin', 'maxWidth' as Numbers

1.0.7

5 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago