Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do you enable withKnobs as a global? #1821

Closed
fourcolors opened this issue Sep 7, 2017 · 9 comments
Closed

how do you enable withKnobs as a global? #1821

fourcolors opened this issue Sep 7, 2017 · 9 comments

Comments

@fourcolors
Copy link

I can't seem to get this to work globally?

@igor-dv
Copy link
Member

igor-dv commented Sep 8, 2017

Do you have these files configured:

config.js

import { addDecorator } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';

addDecorator(withKnobs);

addons.js

import '@storybook/addon-knobs/register'

@coreylight
Copy link

Not working for me either, I see the knobs pane but nothing in it. Have the config.js and addons.js as noted.

@igor-dv
Copy link
Member

igor-dv commented Sep 14, 2017

Can you please share an example of the story file where you want to use knobs ?

@coreylight
Copy link

Pretty simple stuff:

import React from 'react';
import { storiesOf } from '@storybook/react';

import Avatar from './index';

const stories = storiesOf('Avatar', module);

stories.add('coreylight@gmail.com', () => {
  return <Avatar email="coreylight@gmail.com" />;
});

@coreylight
Copy link

Perhaps I'm assuming that the decorator will simply enable all component props as knobs? If this isn't true, is it something that can be accomplished?

@igor-dv
Copy link
Member

igor-dv commented Sep 14, 2017

There is a smart knobs addon that does this: https://github.com/storybooks/addon-smart-knobs
Otherwise you need to define each property separately: https://github.com/storybooks/storybook/tree/master/addons/knobs

@coreylight
Copy link

Great! Thanks @igor-dv, I'll look into it.

@stale
Copy link

stale bot commented Nov 2, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks!

@stale stale bot added the inactive label Nov 2, 2017
@stale
Copy link

stale bot commented Nov 17, 2017

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants