New
Storybook for full-stack developersAutomate with Chromatic
Star75,295
Back to integrations
Add your integration
Categories
  • ⭐️ Popular
  • 🧩 Essentials
  • 🛠 Code
  • ⚡️ Data & state
  • ✅ Test
  • 💅 Style
  • 🎨 Design
  • ⚙️ Appearance
  • 🗄 Organize
How to install addons Create an addon
storybook-template-source
Deprecated
Provides an addon for storybook that can display your template as source in a seperate tab
npm install storybook-template-source
12
Downloads per week
Readme View on GitHub

Usage

Install from NPM using thse command

  1. npm i --save-dev storybook-template-source
  2. Register addon in .storybook/addons.js using import 'storybook-template-source/register';
  3. Invoke withTemplateSource in your story like this:
storiesOf('Test Stories', module)
    .add('With template', () => withTemplateSource('<h1>Hello World</h1>'))

Settings

You can provide an optional second object to withTemplateSource to control the behavior. This can be one, any or all of the options below.

{
    pretty: boolean = true; // Pretty prints the HTML output. Defaults to true
}

Example without pretty print:

storiesOf('Test Stories', module)
    .add('With template', () => withTemplateSource('<h1>Hello World</h1>', { pretty: false }))
Join the community
5,867 developers and counting
WhyWhy StorybookComponent-driven UI
Open source software
Storybook

Maintained by
Chromatic
Special thanks to Netlify and CircleCI