1.0.0 • Published 4 years ago

storybook-storygrid v1.0.0

Weekly downloads
18
License
MIT
Repository
-
Last release
4 years ago

Storybook Storygrid

This Storygrid is an addition to the storybook tool, which allows you to use grids. These Storygrids help structure elements in the preview.

Getting Started

Install package:

npm i storybook-storygrid

Simple example story:

import React from 'react';
import { StyleGrid } from 'storybook-storygrid';

export const Overview = () => (
  <StyleGrid>
    Default
    <Button text="Button Text" />
    <Button text="Button Text" disabled />
  </StyleGrid>
);

Nesting of Storygrids:

import React from 'react';
import { StyleGrid } from 'storybook-storygrid';
import { MyComponent } from 'pathto/MyComponent';

export const Overview = () => (
  <StyleGrid>
    <StyleGrid>
      Not expanded
      <MyComponent expanded={false} />
      Expanded
      <MyComponent expanded={true} />
    </StyleGrid>
    <StyleGrid>
      Styled
      <MyComponent
        expanded={true}
        style={{
          background: 'red',
        }}
      />
    </StyleGrid>
  </StyleGrid>
);

Crop Marks

By default the Crop Marks are being displayed.

Screenshot of a storybook with Storygrid and Crop Marks.

Disable Crop Marks

You can disable them by deleting following line in the StyleGrid/index.tsx file:

<CropMarks forceShowSizes={showSizes}>{child}</CropMarks>