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.

[addon-docs] Why Props component doesn't work?

See original GitHub issue

In index.stories.mdx :

import { Meta, Preview, Story, Props } from '@storybook/addon-docs/blocks';
import { HomePanel } from '@/index';

<Meta title='Mdx|Home|Panel' component={HomePanel} />

# HomePanel

With `MDX` we can define a story for `HomePanel` right in the middle of our
markdown documentation.

<Preview>
  <Story name='Panel'>
     <HomePanel title="abc" amount="1000" description="123" />
  </Story>
</Preview>

## Props

<Props of={HomePanel} />

In HomePanel.tsx:

import React, { ReactNode, FC } from 'react'

interface HomePanelProps {
  title: string | ReactNode
  amount: string | ReactNode
  description: string | ReactNode
  style?: Object
}

const HomeCreditPanel: FC<HomePanelProps> = ({ title, amount, description, style }) => {
  return (
    <div className="panel" style={style}>
      <div className='title'>
        { title }
      </div>
      <div className='amount'>
        {amount}
      </div>
      <div className='description'>
        {description}
      </div>
    </div>
  )
}

export default HomePanel

But the docs shows: image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Mu-xuecommented, Dec 6, 2019

It works when I add ‘export’:

- const HomeCreditPanel: FC<HomePanelProps> = ({ title, amount, description, style }) => {
+ export const HomeCreditPanel: FC<HomePanelProps> = ({ title, amount, description, style }) => {

I just saw it in react-docgen-typescript-loader image

However, I am still unable to understand why…

0reactions
Zunaibcommented, Dec 6, 2019

Are you able to showcase prop descriptions ? Mind sharing your presets and config

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docs Addon | Storybook: Frontend workshop for UI development
DocsPage is a zero-config aggregation of your component stories, text descriptions, docgen comments, props tables, and code examples into clean, readable pages.
Read more >
Issue with Storybook autogenerating docs/prop description for ...
I added storybook to the repo and modified a few of the webpack rules for my .scss files to load properly. I can...
Read more >
Compare DocsPage and MDX syntax in Storybook with example
DocsPage · MDX · Unlocking Storybook's superpower... using MDX this time · Example: Card Component · Working with props using args and argTypes...
Read more >
React Top-Level API
If you load React from a <script> tag, these top-level APIs are available on the React ... Component doesn't implement shouldComponentUpdate() , but...
Read more >
Docs • Svelte
With this, npm run build will generate HTML, JS and CSS files inside the ... It will be used if the component's consumer...
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