Search code examples
storybook

Set a custom title to a named-export Story


How do you give a title value to an individual story in storybook?

Seems like it should be storyname.title = 'value' but that doesn't work.

For example:

export default {
  title: "Root Component Title",
  component: SomeComponent,
};

export const SomeComponentVariant = () => <SetUpTwoFAContainer />;
// This title does not work
SomeComponentVariant.title = "Set Up Parent Container";

Solution

  • You can simply rename the exported const from SomeComponentVariant to SetUpParentContainer and the story will be rendered with the title "Set Up Parent Container":

    enter image description here