styleguidist/react-styleguidist

Add a "View HTML" button

Open

#968 opened on May 7, 2018

View on GitHub
 (6 comments) (9 reactions) (0 assignees)TypeScript (1,416 forks)github user discovery
help wanted

Repository metrics

Stars
 (11,091 stars)
PR merge metrics
 (PR metrics pending)

Description

Many design systems can be used simply as a CSS library as well as React component library.

The styleguides document how to use the components both as React and as pure HTML with CSS classes. E.g.: https://designsystem.gov.au/components/buttons/

We are using Styleguidist and would like to add a "View HTML" button next the the "View Code" button that presents a read-only view of the currently rendered React component.

This would allow users to just download our CSS bundle and implement our components using which rendering technology is appropriate to them.

I haven't tried implementing this yet, but I would look at ways of accessing the innerHTML of a rendered Preview in Playground, though I realise this is a little quirky from a React perspective.

I would make the feature optional, and update slots to take a configuration object to determine whether to include the extra tab button and panel.

Happy to have a go at creating a pull request if you would be happy including this feature in React Styleguidist.

Contributor guide