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

Is it possible to add extra info for a specific story #10823

Closed
danielo515 opened this issue May 18, 2020 · 6 comments
Closed

Is it possible to add extra info for a specific story #10823

danielo515 opened this issue May 18, 2020 · 6 comments

Comments

@danielo515
Copy link

I was guessing if it is possible to add certain extra documentation to one story. I'm not talking about using mdx, but adding some "notes" to one particular story and let them show up on the generated documentation.

@shilman
Copy link
Member

shilman commented May 19, 2020

https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/recipes.md#migrating-from-notesinfo-addons

We'll be supporting this more natively in a future release

@danielo515
Copy link
Author

Thanks for the answer
so the way to go for now, if I understood correctly is:

  • Write that decorator and add it to preview.js
  • use the same decoration as if you are using the notes addon but the notes addon is not required

Am I correct? Is it possible to directly add the docs -> extraComponentDescription into the component itself rather than using this decorator?

Thanks and regards.

@shilman
Copy link
Member

shilman commented May 20, 2020

@danielo515 yes you can add override extractComponentDescription. Also, depending on which framework you're using, you can also add docgen comments above your component definition, e.g. React:

import React from 'react';

/**
 * Some button description
 */
export const Button = () => <button>hi</button>

@danielo515
Copy link
Author

@shilman I tested the proposed solution and the comments are added to the top of the documentation page, not to the specific story where I defined the parameter. Is that the expected behaviour or I did something wrong?

@danielo515
Copy link
Author

My request is exactly the same as #8527
And I can workaround it with: parameters.docs.storyDescription

@shilman
Copy link
Member

shilman commented May 21, 2020

Aha there’s also a community provided webpack plugin to do it at the story level. Don’t have the link handy.

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

2 participants