Skip to content

Decorators in HTML edition of Storybook #24661

Discussion options

You must be logged in to vote

I am using HTML version as well, and we are using a few decorators!

.storbyook/preview.js


const withWrapper = (story, context) => {
  if (context.args.myArg) {
    document.body.style.width = '94%';
    document.body.style.margin = '0 auto';
//wrap your story in whatever code you like
    return `<div>${story()}</div>`;
  }
  return `${story()}`;
};


export const decorators = [withWrapper];

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dgibson666
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants