Giter Site home page Giter Site logo

fdendorfer / storybook-addon-grid-overlay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidbepa/storybook-addon-grid-overlay

0.0 0.0 0.0 517 KB

Storybook addon that enhances the visual layout of Storybook stories by providing a grid overlay

License: MIT License

JavaScript 10.67% TypeScript 62.99% CSS 7.69% HTML 0.15% MDX 18.50%

storybook-addon-grid-overlay's Introduction

storybook-addon-grid-overlay

example of the addon displaying the grid pverlay when active

Storybook addon that enhances the visual layout of your Storybook stories by providing a grid overlay. It allows you to easily align and position your components within a grid system, making it easier to create clean, consistent designs.

With this package, you can define custom grid settings, such as grid max size, column count, gap and gutter spacing, and easily toggle the grid overlay on or off while previewing your components in Storybook.

Installation

Using npm:

npm install --save-dev storybook-addon-grid-overlay

Using yarn:

yarn add storybook-addon-grid-overlay --dev

Add the following to your .storybook/main.js exports:

module.exports = {
  addons: ['storybook-addon-grid-overlay']
};

Customization

The grid can be customized using parameters, you can set them globally or per story.

Parameters

Name Description Type Default value Required
columns The number of columns number | string 12 no
gap The gap between columns string '20px' no
gutter Horizontal gutter (spacing) string '0px' no
maxWidth The maximum width of the overlay string 'none' no
color The color of the columns string 'rgba(255, 71, 132, 0.15)' no

Global setup

export const parameters = {
  gridOverlay: {
    columns: 12,
    gap: '20px',
    gutter: '20px',
    maxWidth: '1024px'
  }
};

Story setup

export const MyComponent = () => {...};

MyComponent.parameters = {
	gridOverlay: {
        gutter: '20px'
    }
};

Using css variables

The storybook-addon-grid-overlay is designed to accept CSS variables as parameters, allowing you to make the grid responsive to your designs.

@media (min-width: 768px) {
  :root {
    --columns: 8;
    --gap: 12px;
    --gutter: 24px;
    --maxWidth: 1024px;
  }
}
export const parameters = {
  gridOverlay: {
    columns: 'var(--columns)',
    gap: 'var(--gap)',
    gutter: 'var(--gutter)',
    maxWidth: 'var(--maxWidth)'
  }
};

storybook-addon-grid-overlay's People

Contributors

davidbepa avatar offbeat-dev avatar fdendorfer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.