Storybook: The addon-viewport tab does not show in storybook

Created on 15 Mar 2019  路  7Comments  路  Source: storybookjs/storybook

Describe the bug
Addon-viewport tab does not show in storybook
There are no issues in starting up storybook.
Is there something I'm missing in configuration?

To Reproduce
Steps to reproduce the behavior:

  1. npm install --save-dev @storybook/addon-viewport
  2. import '@storybook/addon-viewport/register'; inside addons.js

Expected behaviour
The Viewports tab is expected to show up in Storybook

Screenshots
image

Code snippets
This is my config.js

import { configure } from '@storybook/react';
import { addParameters } from '@storybook/react';
import {
  configureViewport,
  INITIAL_VIEWPORTS
} from '@storybook/addon-viewport';

import 'Styles/index.scss';


// automatically import all files ending in *stories.js
const req = require.context('Components', true, /stories\.js$/);
const loadStories = () => {
  req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);

const newViewports = {
  mobile: {
    name: 'Mobile',
    styles: {
      width: '320px',
      height: '568px'
    }
  },
  tablet: {
    name: 'Tablet',
    styles: {
      width: '768px',
      height: '1024px'
    }
  },
  laptop: {
    name: 'Laptop',
    styles: {
      width: '1200px',
      height: '1024px'
    }
  },
  desktop: {
    name: 'Desktop',
    styles: {
      width: '1366px',
      height: '1024px'
    }
  },
  wide: {
    name: 'Wide',
    styles: {
      width: '1920px',
      height: '1080px'
    }
  }
};

configureViewport({
  viewports: newViewports,
  defaultViewport: 'Mobile'
});

this is my addons.js

import '@storybook/addon-viewport/register';
import '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';

System:

  • OS: [Ubuntu 16.04 LTS]
  • Device: [Lenovo-B50-+]
  • Browser: [chrome]
  • Framework: [react]
  • Addons: ["@storybook/addon-viewport]
  • Version: [e.g. ^5.0.1]
viewport question / support

Most helpful comment

@mkchx Not AFAIK. @ndelangen any plan on making addon UI more portable? Seems like people want to move stuff around

All 7 comments

It's now in the toolbar at the top of the screen, furthest icon on the right. Do you need it to show up in a tab?

Ah! It was in a tab in previous versions, next to Knobs tab so I was confused why it wasn't here.
https://github.com/storybooks/storybook/blob/master/addons/viewport/docs/viewport.png

I don't think this issue should be closed since the Readme is still wrong and causing confusion.

@lhguerra Mind taking a pass at updating the README and creating a small PR?

@shilman not at all. Will do it tonight.

@shilman Is it still possible to have it as a tab? instead of an icon with drop-down options

@mkchx Not AFAIK. @ndelangen any plan on making addon UI more portable? Seems like people want to move stuff around

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tlrobinson picture tlrobinson  路  3Comments

rpersaud picture rpersaud  路  3Comments

levithomason picture levithomason  路  3Comments

purplecones picture purplecones  路  3Comments

Jonovono picture Jonovono  路  3Comments