Forem Creators and Builders 🌱

Cover image for Changelog: New features in our Storybook docs
Suzanne Aitchison for Forem Core Team

Posted on

Changelog: New features in our Storybook docs

For anyone interested in contributing to the frontend of Forem, our Storybook is a really helpful resource - and it just got better πŸŽ‰

Wait, what is Storybook?

Our Storybook collects functioning examples of our "Crayons" design system components, along with accompanying notes about how to implement them.

Screenshot of the Storybook interface, on the Button page.

Tweaking the component

You can use the "Knobs" section to change the various settings for each component (e.g. size, variant, additional class names).

Screenshot highlighting the "Knobs" tab

Viewing in different themes (recently fixed! πŸ”§)

You might have noticed that users can select from multiple "themes" in their Forem settings, which changes the colour of many of these components. To see what a component looks like in different themes, you can use the switcher at the top of the page:

Screenshot of the button component in the "Hacker" theme. The theme switcher dropdown is highlighted.

Copying the markup (NEW ✨)

Once you've experimented with the settings for your component, you're now able to copy either the JSX (if you're using the component in a Preact area of the codebase), or the HTML markup, ready to paste directly into the code you're working on!

All of the customisations you added in the "Knobs" section will be reflected in the copied markup, meaning you don't have to worry too much about classnames or props πŸ™‚

To view and copy the JSX, click on the "JSX" tab:

Screen shot of the button UI, with the JSX tab visible and highlighted. The JSX of the Button component is visible and there is a copy button in the bottom right.

To view and copy the plain HTML, click on the "HTML" tab:

Screen shot of the button UI, with the HTML tab visible and highlighted. The HTML of the Button component is visible and there is a copy button in the bottom right.

Hopefully these new features should make contributing to the frontend of Forem that little bit easier, and we're looking forward to enhancing these docs more in the future πŸš€

Happy coding!

Top comments (3)

Collapse
 
s_aitchison profile image
Suzanne Aitchison

This particular change will only impact developers being able to preview how a component looks in different "out of the box" themes. New users of a Forem will continue to see the default theme first, but if there's a customization you think would be useful here, you can always post a feature request to let us know!

Collapse
 
rhymes profile image
rhymes

This is awesome!!

Collapse
 
nickytonline profile image
Nick Taylor

Love this addition! Nice work @s_aitchison !