Storybook 4 migration addon-knobs is not working
See original GitHub issueHi Team
After migration to Storybook 4, I am facing an issue with addon-knobs, the panel appears but with “No Knobs” string, where almost every story contains knobs to change the properties of the component.
Before the migration, these were working.
Small Info about the current project structure setup:
- addon.js contains the following:
 
import '@storybook/addon-knobs/register'
- config.js contains the following code:
 
import { withKnobs } from '@storybook/addon-knobs'
const req = require.context('../stories', false, /\-story\.tsx$/)
function loadStories() {
  req.keys().forEach(filename => req(filename))
}
addDecorator(withNotes)
addDecorator(withKnobs)
- small-story.tsx looking like below:
 
import * as React from 'react'
import { MemoryRouter } from 'react-router'
import { object } from '@storybook/addon-knobs'
import { getStory, StoryInfo, addChapter } from './common'
import { Component } from './imports'
const storyInfo: StoryInfo = { label: 'Component ', readMeKey: 'ComponentReadme' }
const defaultValue = [
  { _id: 'newId_1', label: 'Test 101' },
  { _id: 'newId_2', label: Test 102' },
]
const ComponentStory = getStory(storyInfo).addDecorator((story: any) => (
  <MemoryRouter initialEntries={['/']}>{story()}</MemoryRouter>
))
addChapter(
  ComponentStory ,
  {
    name: 'introduction',
    information: `Displaying the naviagtion path to the current node`,
    note: `To Display bread crumbs in order to show path`,
  },
  <Component prop={object('prop', defaultValue)} />,
)
If you need more information from my side, please let me know.
Any pointers or hints will be useful.
Thanks and regards Amit
Issue Analytics
- State:
 - Created 5 years ago
 - Reactions:3
 - Comments:17 (6 by maintainers)
 
Top Results From Across the Web
Storybook Addon Knobs (deprecated)
Storybook Addon Knobs allow you to edit props dynamically using the Storybook UI. You can also use Knobs as a dynamic variable inside...
Read more >Storybook problem while migrating argument of type object ...
Can I create a Knob in React Storybook to modify an array with 4 values where each value has a select dropdown? 3...
Read more >storybook-addon-playwright - npm
An addon to visually test the stories in the multiple browsers within storybook environment. Addon will not work in storybook static build, ...
Read more >@types/storybook__addon-knobs | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >MIGRATION.md - Storybook - Fossies
React 16.3+; Generic addons; Knobs select ordering; Knobs URL parameters ... Does not work with storiesOf(); Does not work if you use dynamic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@amittkSharma and @KudMath.
package.json dependencies
Note: I did not add withKnobs decorator globally, I added it to respective components which have KNOBS like below:
storiesOf(‘Vue.Carousel’, module) .addDecorator( withKnobs({ escapeHTML: false }) ) .addParameters({ options: { selectedAddonPanel: ‘storybooks/storybook-addon-knobs’ } }) .add(‘Playground’, () => ({ … }));
withKnobsOptions is deprecated in Storybooks 4.0
This solved it for me: https://stackoverflow.com/a/57067253/1048589