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.

storySort: support sorting a kind to the bottom of the list

See original GitHub issue

Is your feature request related to a problem? Please describe We recently upgraded to Storybook 6, and so far it has been a big improvement. The new storySort order option greatly simplifies our configuration, which is awesome. However, we currently have our component stories sorted like this:

  • Guides
  • [alphabetical list of all components in our library]
  • Internal
  • WIP

From what I can tell, in order to get this sorting with the new order config, we would need to manually list out every single component in the library.

Describe the solution you’d like The simplest solution would be to support a * option in the list which means “anything (at this level) not explicitly listed here,” which would make the configuration look like:

order: ['Guides', '*', 'Internal', 'WIP']

or for second-level ordering:

order: ['Components', ['Guides', '*', 'Internal', 'WIP'], 'Pages']

Describe alternatives you’ve considered Another option would be to have some sort of signifier such as ! in front of the options (to match anything except the specified option). For example:

order: ['Guides', '!Internal', '!WIP']

but personally I find this syntax might be a bit confusing.

Are you able to assist to bring the feature to reality? I am willing to help contribute this fix to the library.

Additional context N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
sarahbethfedermancommented, Jun 28, 2021

This doesn’t seem to work the way that I expected in nested stories. I assumed I would be able to use it like so to say that within Components category, subitems named ‘Overview’ should be sorted first.

{ order: [
    'Components', ['*', ['Overview']]
  ] 
}

This seems to have no effect? I was expecting to see Components/Button/Overview in the sidebar with Overview displayed as the first item underneath Button.

I was hoping to avoid having to write out every component (which should already be in alphabetical order) in order to sort the pages underneath each component.

1reaction
shilmancommented, Apr 10, 2021

Yay!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.3 containing PR #14531 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there’s still more to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Naming components and hierarchy - Storybook - JS.ORG
To sort your stories using a custom list, use the order array; stories that don't match an item in the order list will...
Read more >
Sorting in Storybook: Possible to force an order for nested ...
Each component has a README mdx file, and then all stories nested under Examples. I'm currently sorting stories like this: options: { storySort:...
Read more >
Storybook - Structuring and naming - Daily Dev Tips
Organizing and structuring our Storybook component hierarchy.
Read more >
Storybook Configuration With CRA and TypeScript - Pagepro
Type the command below in your terminal (inside a directory with your project base created earlier with CRA – it should be in...
Read more >
Netflix's thriller Only Mine is based on a true story — sort of
There is never a good time to release a thriller about a violently murderous domestic abuser who happens to be a cop and...
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