Whilst building the web version of Paw (a Mac app), I chose to build our UI around a reusable component library. Our CEO later decided to make the components available across the company. Taking the library from within the app, I built out a common UI Toolkit for RapidAPI.

I designed the initial architecture and component library, and created Storybook and documentation for the integration. I worked with designers on the components and themes. As other engineers joined, I continued to build out the UI Toolkit, helping product teams adopt it too. By late 2022 it was a common dependency for 13 projects.

A library without shared application ownership

The library was kept in a separate monorepo. The components were published as private packages and the product teams integrated them into their apps as dependencies. They had their application code in their own repos and therefore retained control of their applications. If they wanted to make any changes to the UI Toolkit they could do so via a PR.

I also considered Bit.dev but all the requirements were provided by Storybook, private packages and versioning. Using Bit.dev would mean introducing a new ecosystem and contribution process. I wanted to start off with compiled packages and use them as normal dependencies. A shared dev environment for the application and the UI Toolkit would allow for live updates but require some extra build configuration.

This meant we had a central place to develop the components but the product teams still had ownership of their applications. When designing the library I needed to take those apps into account. Changes to a component's API or dependencies could affect projects outside our repo.

A bridge for Vue teams

Not all teams could use the React component library as they were using Vue for their applications. However, due to a decision by the CEO they were moving over to React. They needed the common components in their current applications.

I suggested using an existing package called Vuera to allow React components to be used in Vue. I documented how they could integrate the components by installing the React dependencies, setting up Vuera and configuring the theme.

This added an extra layer for integrating the components and meant having the React runtime in a Vue application. We could use our components without having to maintain another native Vue implementation. The UI Toolkit remained a React library and Vuera acted as a bridge during migration.

Supporting the engineers using it

I made Storybook the starting point for teams adopting the toolkit. Engineers could find integration guides and working examples there, and non-technical colleagues could see the components in action. I helped other teams integrate the library and worked with their engineers, leads and managers on questions, requests and suggestions.

The documentation contained information on installation, basic usage, layout examples, customization and Vue integration.

The components needed to be installed from the private package registry. The theme and fonts also needed to be configured. I documented how to do this with working examples.

Supporting changes across consuming projects

In May 2021, I set up CI to run the test suite and send Storybook builds to Chromatic for visual regression checks. Engineers could view the test results and previews of components when reviewing changes.

Breaking changes required some work in the applications to migrate. I created a migration guide for UI-lib 2 so engineers knew which peer dependencies to update, where to import ThemeProvider and what had changed with Box and Flex.

In January 2023, I replaced Lerna's release workflow with Changesets for package versions and changelogs. Teams installed releases in their own repositories; publishing did not update their applications.

Shared foundations and local needs

I worked with designers on typography, colors and component behavior aligned with Figma. Teams could receive shared changes through the toolkit instead of implementing them separately.

Based on those integration conversations, I proposed a three-level model to designers and product teams. A page component served a single page. A project-level component could be reused in several parts of a project and sometimes across projects. A shared component belonged in the company-wide UI Toolkit. Components could move between levels as their use changed.

An engineer could extend the theme or override an individual component's styles without copying its implementation. I added utilities for both, along with polymorphic types. I also updated Box and Typography so engineers could choose a different underlying element and keep the shared styling API.

That left more APIs to maintain: the theme structure, overrides and component types. A change to our styling approach would have to account for how applications used them, as well as the components inside the library.

The result

By late 2022, 13 projects, including a proof of concept, used the toolkit as a shared standard. Vue teams could use it during their React migration. Storybook, integration and migration guides, and versioned packages supported adoption and updates.