HomePostsintroduction to storybook

Introduction to Storybook: Building component driven UIs faster

Date
Last Updated
Profile Picture
Peter White@petewht
Contents

Building high quality user interfaces (UIs) can be a time-consuming and challenging task, especially when it comes to achieving consistency and maintainability.

Fortunately, Storybook offers a solution that can streamline the process and make it more efficient by bringing engineering and design teams together.

During a lightning talk in 2022, I shared my insights on Storybook and its impact on UI development. Whether you prefer to listen to the original audio recording, browse through the slides, or read the Descript transcript, I've got you covered. And for those short on time, I've included a quick summary to give you a glimpse of what Storybook can do for you.

Slides

Audio

Transcript

Summary

Building user interfaces (UIs) can be a difficult and time-consuming process. However, adopting an atomic design system can make the process faster, collaborative and efficient. In this post, we'll explore what component-driven UI means, the benefits of adopting it, and how Storybook can be used to keep design and engineering teams in sync.

What Does Component-Driven UI Mean?

Component-driven UI is a development and design practice of building UIs with modular components. UIs are built from the "bottom up," starting with basic components and progressively combining them to assemble screens. Components are built in isolation, and their states are defined. This approach allows developers to build UIs with standardized, interchangeable building blocks or LEGO blocks.

What Are the Benefits of Component-Driven UI?

Component-driven UI has several benefits, including:

  • Reusability - Using components allows developers to reuse the same piece many times over many projects. Each piece is self-contained and interchangeable with other pieces.

  • Testability - Testing components individually is much more manageable than testing an entire system all at once. Storybook unlocks more formal testing opportunities through snapshot, accessibility, and interaction testing.

  • Efficiency - Using a component-based approach will speed up every step in the process. When components live in a central library, team members can use, add, or update them at any time during the process. Component reuse allows costs and time-to-market to be reduced.

  • Consistency - Having a robust component library ensures user experience consistency across all projects by acting as the source of truth.

  • Maintainability - Component-based applications are easier to maintain, as changing one component propagates across the whole application in a predictable way. Bug fixes to components apply everywhere automatically.

What are some other benefits of Storybook?

Storybook also unlocks component-level testing:

  • Visual snapshot testing helps catch issues with components before they make it to production by highlighting any unexpected changes
  • Accessibility testing ensures that user interfaces are easy for everyone to use, not just those with disabilities. For example, adding tabIndex to forms can make them more accessible for people who may only have one hand free, such as when trying to fill out a form while holding a coffee
  • Storybook's AXE add-on flags when accessibility standards are not met, which is important for larger enterprise and government deals with legal accessibility requirements.
  • Interaction testing can also be done at the component level, ensuring that components behave as expected.

How Does This Change the Contract Between Engineering and Design?

Design and engineering teams have to agree on what a completed component is, publish the Storybook publicly so stakeholders can give feedback, and use as few components as possible, preferring props where possible. This avoids component specialization bloat. Storybook should be used as the "source of truth" where possible, with reviews and feedback given based on components rather than the overall product, so fixes can be applied at the component level.


Thanks for Reading!

I always appreciate feedback or suggestions for future blog posts. You can find me on Twitter or if you want to improve the article to help future readers, please feel free to submit a PR.

🦉 2783 days

Duolingo Streak

Proudly created in beautiful Sætre in Norway 🇳🇴