Storybook default export (non-named) in combination with template as opposed to component

Viewed 2915

With storybook you can use a template in an export a named story by:

export default {
  title: 'My Component',
} as Meta;
export const Default: Story<any> = () => ({
  template: `
    <p>My story</p>
  `
});

And this shows up in the sidebar as:

  • My Component
    • Default (<--- don't want this)

But since it's a one page thing, I don't want "Default" to show up in the second level, but just the first level as a link.

Now I've found in the docs that you can use the default export for such a thing:

// Button.stories.js

import React from 'react';
import { Button } from './Button';

export default {
  title: 'Components/Button',
  component: Button, // I don't have a component, just a template
}

However, that default export example makes use of "component" and it does not seem to have a "template" option.

Is there some way you can do this?

1 Answers
Related