When to use Storybook?

Michael Pautov
3 min readJul 8, 2020

--

User Interface has become an essential part of modern development. Several technologies are used together to create attractive and high-performing user interfaces. Creating a simple user interface, with few screens is not a big deal, but as the application grows, the user interface becomes more and more complicated.

The Storybook is a tool that is very helpful while working user interface components. It is basically a development environment in which a developer can create components in an organized manner in isolation.

In this article, we will discuss when to use the storybook.

1. When you need to develop components in isolation

Suppose you are working on a component and this component is to be added to another component which is not ready yet. Say, you need to add a button to a web page but that page is not fully completed. So you have to wait until it is completed and then you can start working on the button. But with the storybook, it is not required to wait because it works completely independently from the real application. You can create the button without even bothering about the pending web page.

You can run the storybook on a separate port on your localhost and create your component there.

2. When there is a need to manage edge test cases

With a vast range of components, there is always a vast range of edge test cases. There can be several test cases for even small components, such as a button, leave the whole application alone.

For example, there is a button and the text on it can change. For one case, the text can be very long and for another, there is no text. You need to adjust the size of the button according to the length of the text. You may need to apply particular CSS properties for a particular length. Storybook has a brilliant facility that provides visuals of such test cases. With such visuality, it becomes easy to manage edge test cases.

3. When there is a need to create awareness regarding the components

You may encounter a situation when multiple developers are working on a single component. Each of them adds the same functionality that is already present. Or, there is a component created by a developer several months ago and the new developer wants the same functionality but he is not aware of the existing component, so he creates a new one. There can be numerous such situations where developers are unaware of the existing components or functionalities, so they start creating a new one.

Using the storybook, you can create a story of a particular component. Each of these stories is basically documentation that contains the visual state of a component. The documentation helps in creating awareness for everyone who is working on the application.

## Conclusion

So these are the situations in which you should your storybook. It is a very helpful tool when you need to create components in isolation and there are several edge test cases.

A huge application always creates confusion among the developers, but with the story facility in the storybook, you can easily create visual documentation that can help eliminate such confusion. Moreover, it has a number add-on that is very useful while creating components.

--

--