My Storybook uses the following grouping for stories:
Introduction
Styleguide
Atoms
Component
š README
š Examples
Component
š README
š Examples
Molecules
Component
š README
š Examples
Organisms
Component
š README
š Examples
Iām currently sorting stories like this:
options: {
storySort: {
method: 'alphabetical',
order: ['Introduction', 'Styleguide', 'Atoms', 'Molecules', 'Organisms'],
locales: 'en-US',
}
},
This gets me close, but the README and Examples within component stories appear in alphabetical order when I want README to appear first.
Is this possible?
I had a similar problem, and I could find a way of doing as you requested, after finding this info on the storybook documentation:

For your specific case, I think that you could do something like this:
options: {
storySort: {
method: 'alphabetical',
order: ['Introduction', 'Styleguide', 'Atoms', ['Readme', '*'], 'Molecules', ['Readme', '*'], 'Organisms', ['Readme', '*']],
locales: 'en-US',
}
},
Basically, you just have to add , ['Readme', '*'] after every group that you like to sort by using the Readme first custom order.
This just indicates storybook to display the Readme story first, and then the rest of the stories.
This approach solves the problem, but I think that the solution could be improved by writing your own storySort functions, as indicated on this comment in github
I hope this answer would be helpful for your scenario too.
Regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With