Socket
Socket
Sign inDemoInstall

storybook-addon-paddings

Package Overview
Dependencies
1
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    storybook-addon-paddings

Add paddings to view components under different white space settings


Version published
Weekly downloads
15K
decreased by-14.08%
Maintainers
1
Install size
107 kB
Created
Weekly downloads
 

Readme

Source

Storybook Paddings Addon

npm package version Build status Dependencies status

🔲 A Storybook addon to add different paddings to your preview. Useful for checking how components behave when surrounded with white space.

Demo

View demo →

Installation

npm install --save-dev storybook-addon-paddings
// .storybook/main.js
export default {
  addons: ['storybook-addon-paddings'],
}

// .storybook/preview.js
export default {
  parameters: {
    layout: 'fullscreen', // remove default Storybook padding
  },
}

Configuration

The paddings toolbar comes with small, medium and large options by default, but you can configure your own set of paddings via the paddings parameter.

To configure for all stories, set the paddings parameter in .storybook/preview.js:

export const parameters = {
  paddings: {
    values: [
      { name: 'Small', value: '16px' },
      { name: 'Medium', value: '32px' },
      { name: 'Large', value: '64px' },
    ],
    default: 'Medium',
  },
}

You can also configure on per-story or per-component basis using parameter inheritance:

// Button.stories.js

// Set padding options for all Button stories
export default {
  title: 'Button',
  component: Button,
  parameters: {
    paddings: {
      values: [
        { name: 'Small', value: '16px' },
        { name: 'Medium', value: '32px' },
        { name: 'Large', value: '64px' },
      ],
      default: 'Large',
    },
  },
}

// Disable addon in Button/Large story only
export const Large {
  parameters: {
    paddings: { disable: true },
  },
}

See other story examples.

Keywords

FAQs

Last updated on 11 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc