Default Landing on the Introduction Page on storybook #16503
Replies: 4 comments
-
Unsure if this solves your usecase but you can make the first story and first page of it a documentation only page with https://storybook.js.org/addons/@storybook/addon-docs |
Beta Was this translation helpful? Give feedback.
-
Storybook shows the first story by default and the suggested approach is to make your first story a documentation page. When you navigate to the storybook, it shows this by default. One thing to note is that if you are running Storybook in dev mode (e.g. |
Beta Was this translation helpful? Give feedback.
-
If your introduction page is still not the first story, make sure that story sorting isn't interfering with your desired order. |
Beta Was this translation helpful? Give feedback.
-
You can fix this with
To sort stories alphabetically, you can do this
|
Beta Was this translation helpful? Give feedback.
-
Problem Statement/Feature Request:
I would like to see a way to add the introduction.mdx file as one of the path to the stories and the storybook should land on the Introduction page instead of the first story.
I have tried multiple ways from different platforms like dev.io, stackoverflow. Please see below the list of ideas I tried from the community.
I began by following this stack overflow idea. This involves selecting the Kind and Story based on the url parameter to identify the story to land on, but this did not work in our case.
https://stackoverflow.com/questions/53724555/specify-default-page-for-storybook
This approach also specifies using the addOnAPI from storybook addOns, to always choose the landing page to be the introduction mdx file. This did not work.
module.exports = { stories: [ "./Introduction.stories.mdx", "../components//.stories.tsx" ], addons: [ "@storybook/addon-links", "@storybook/addon-essentials" ]}
The default page issue was still not resolved. Later I noticed that this path was already configured properly as when I open storybook , the introduction page showed at top of other component stories.
storybookAPI.selectStory('FirstKind', 'default story');
to match the appropriate story name. It still didn't resolve the issue. So I tried selecting a different component story to check if it can set other components as default. It didn't work.
https://dev.to/committedsw/storybook-docs-first-page-1ick
It too didn't work
I looked for storybook official docs and looked through all the related docs and found no exact clue about setting up default page loading. https://storybook.js.org/docs/react/configure/overview
I looked into the storybook addons docs https://storybook.js.org/docs/react/addons/writing-addons but found no useful info.
Beta Was this translation helpful? Give feedback.
All reactions