storybook.js.orgstorybook.js.org

How to sort stories alphabetically in Storybook (6.2)

Estimated 1 minute readย ยทย Monday, 17 January 2022
.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 });
    }
  },
};
We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking 'Accept', you agree to our website's cookie use as described in our Privacy Policy.