Show template's code with @Storybook/addon-docs

Viewed 631

I'm documenting my components in Storybook. I added @storybook/addon-docs and in *.stories.ts I defined story like this:

export const Button = () => ({
  template: '<button class="button">Delete</button>',
});

Button with styling is shown correctly, but when someone clicks "Show code", it shows story's code, not just the template.

() => ({
  template: '<button class="button button-danger">Delete</button>'
})

Is it possible to configure, that "Show code" shows template, not whole story?

1 Answers

Try commenting, docs source

//Connect below line from .stories.js
parameters: {
 docs: {
  source: {
    type: 'code'
  }
 }
}
Related