New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

debug-grid-overlay-custom

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

debug-grid-overlay-custom

Display your design's grid as an overlay on top of your web site or app to debug positioning of elements.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Debug Grid Overlay

🏁 Display your design's grid as an overlay on top of your web site or app to debug positioning of elements.

Usage

Import it as a ES6 module and initialize it:

import debugGridOverlay from 'debug-grid-overlay';

debugGridOverlay({
    columns: 24,
    columnWidth: '1fr',
    gutterWidth: '16px',
});

You can now trigger the overlay by pressing on lowercase "g" on your keyboard. You can also toggle the overlay manually by calling the .toggle() method.

Note: You should disable this in your production build by wrapping the initialization in a conditional, like so:

if (process.env.NODE_ENV === 'development') {
    DebugGridOverlay();
}

Options

const debugGrid = debugGridOverlay({
    columns: 12,
    // The amount of columns in your grid
    // Default: 12

    columnWidth: '1fr',
    // Default: 1fr

	gutterWidth: '16px',
    // Default: 16px

	maxWidth: '1344px',
    // Sets a max width for your grid
    // Default: null,

	marginsWidth: '40px',
    // Sets outer document margins for your grid
    // Default: null

	verticalRhythm: '20px',
    // Useful for seeing if your design confirms to the vertical rhythm
    // Default: 20px

	keyCode: 71,
    // Keyboard key code that triggers the overlay
    // Default: 71 (lowercase 'g')
});

API

Events

const debugGrid = debugGridOverlay();

debugGrid.on('toggled', (visible) => {
	if (visible) {
		console.log('Grid has been toggled on');
	} else {
		console.log('Grid has been toggled off');
	}
});

Keywords

FAQs

Package last updated on 05 Feb 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc