Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/addon-viewport

Package Overview
Dependencies
Maintainers
12
Versions
2010
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-viewport

Build responsive components by adjusting Storybook’s viewport size and orientation

  • 0.0.0-pr-30021-sha-b1cc74da
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.4M
decreased by-38.33%
Maintainers
12
Weekly downloads
 
Created

What is @storybook/addon-viewport?

The @storybook/addon-viewport package allows developers to customize the viewport size to simulate different screen sizes in Storybook's UI. This is particularly useful for ensuring that components and layouts are responsive and look good on various devices, from mobile phones to desktop monitors.

What are @storybook/addon-viewport's main functionalities?

Custom Viewport Configuration

This code configures Storybook to use a set of predefined viewports. The INITIAL_VIEWPORTS constant provides a list of common device resolutions that can be used to test the responsiveness of components.

import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';

export const parameters = {
  viewport: {
    viewports: INITIAL_VIEWPORTS,
  },
};

Adding New Viewports

Developers can add custom viewports to the Storybook configuration. This code sample demonstrates how to add new devices, such as Kindle Fire 2 and Kindle Fire HD, with specific resolutions to the viewport addon.

export const parameters = {
  viewport: {
    viewports: {
      kindleFire2: {
        name: 'Kindle Fire 2',
        styles: {
          width: '600px',
          height: '963px',
        },
      },
      kindleFireHD: {
        name: 'Kindle Fire HD',
        styles: {
          width: '533px',
          height: '801px',
        },
      },
    },
  },
};

Other packages similar to @storybook/addon-viewport

Keywords

FAQs

Package last updated on 11 Dec 2024

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