Casting spells
storybook.js.orgstorybook.js.org
Gradient background

How to sort stories alphabetically in Storybook (6.2)

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Monday, 17 January 2022 · Estimated 1 minute read
.storybook/preview.js
Copy
export const parameters = {
  options: {
    storySort: (a, b) => {
      const aId = a[1].kind;
      const bId = b[1].kind;
      return aId === bId
        ? 0
        : aId.localeCompare(bId, undefined, { numeric: true });
    }
  },
};