question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] argTypes not working in mdx

See original GitHub issue

What version of vite are you using?

2.9.13

System info and storybook versions

  System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 Intel(R) Core(TM) i7-10750
H CPU @ 2.60GHz
  Binaries:
    Node: 18.4.0 - ~\scoop\persist\nvm\nodej
s\nodejs\node.EXE
    npm: 8.12.1 - ~\scoop\persist\nvm\nodejs
\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromiu
 6.5.9
    @storybook/addon-links: ^6.5.9 => 6.5.9
    @storybook/addon-notes: ^5.3.21 => 5.3.21
    @storybook/addon-postcss: ^2.0.0 => 2.0.0
    @storybook/builder-vite: ^0.1.36 => 0.1.38
    @storybook/csf-tools: ^6.5.9 => 6.5.9
    @storybook/testing-library: ^0.0.13 => 0.0.13
    @storybook/theming: ^6.5.9 => 6.5.9
    @storybook/vue3: ^6.5.9 => 6.5.9

Describe the Bug

When using argsTypes in MDX the changes are not being applied to the argsTable. The same component and config works as expected when using a normal CSF file.

Reproduction:

component.stories.mdx

import { Meta, Canvas, Story, ArgsTable, Description  } from '@storybook/addon-docs'
const Component = {
  description: 'test',
  props: {
    id: String(),
    status: String(),
    label: String()
  },
  __docgenInfo: {
    displayName: 'component',
    props: [
      {name: 'id', required: true, type: {name: 'number'}},
      {name: 'status', required: true, type: {name: 'string'}},
      {name: 'label', required: true, type: {name: 'string'}}
    ]
  }
}

<Meta title="component"  component={Component}  argTypes={{
  status: {
    name: 'Badge Status',
    description: 'Available options available to the Badge',
    options: [
      'positive',
      'negative',
      'warning',
      'error',
      'neutral'
    ],
    table: {
      defaultValue: {
        summary: 'positive'
      },
      type: {
        summary: 'Shows options to the Badge',
        detail: 'Listing of available options'
      },
    },
  },
  label: {
    name: 'Badge Content',
    description: 'Text shown by Badge',
    control: {
      type: 'text'
    },
    table: {
      type: {
        summary: 'The label contents',
        detail: 'Text displayed by the Badge'
      }
    }
  }
}} />

<ArgsTable for={Component} />

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
khuezycommented, Dec 16, 2022

MDX ArgsTable is working for me on the 7.0.0 beta

1reaction
unicornwarecommented, Jul 24, 2022

@joshwooding do you have any links to issues or docs regarding this issue? i was searching for known issues surrounding this matter while i was debugging, but couldn’t find any.

Read more comments on GitHub >

github_iconTop Results From Across the Web

storybook: Using argtypes in mdx does not have control
That's weird because in our projects we are using this approach and it's working. In this link, I can't see an example with...
Read more >
MDX Format - Storybook - JS.ORG
MDX is a standard file format that combines Markdown with JSX. It means you can use Markdown's terse syntax (such as # heading...
Read more >
storybook/addon-controls - npm
Start using @storybook/addon-controls in your project by running `npm i ... Knobs is also a mature addon, with various options that are not...
Read more >
Storybook: addons/docs/docs/props-tables.md - Fossies
Customizing ArgTypes; Custom ArgTypes in MDX ... In order to show controls, ArgsTable must be a function of a story, not a component:...
Read more >
Next-level component showcasing with Storybook controls
At the time of this writing, Storybook does not work out of the ... We have to configure the controls further with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found