Why You Shouldn't Make a Component Library
Building a UI component library for your project is a popular idea these days. If you're reading this, I'm assuming you already know what a component library is.
What I'm talking about is the idea that you should build an Angular Material type component library for your company projects. You would probably use a tool like Storybook to build your library in React. I came up with some questions to ask yourself before building your component library.
Does it deliver enough value for the cost?
Let's imagine a scenario where you're starting a new project with a client. You're building a line of business application that will help the client save time and thus cut costs for their business.
If you decide to build a component library for this project, congratulations you've just started two projects. You have the client's app and now you have a component library project to build and maintain. Does your client even care about a component library? Will they reuse the components across multiple applications? You'll also have to put someone or possibly a team in charge of maintaining this component library project or else it will just fall into disarray.
Writing good CSS can be good enough for these types of projects, and you should be doing that anyways.
How well thought out are the designs?
In the software development industry, developers are often handed designs to build the UI from. UI design tools like Figma and Sketch let designers componentize certain design elements like buttons, input fields and page headers. The problem I've seen is that these designs are rarely thought to the level of depth needed to create a true component library. Just think about how much investment has been put into creating something like Angular Material.
Designers use a feature called components in their design tool which allows them to repeat designs across a design project, but they don't really grasp the idea of what a component is in a component library sense. I think of a component library as a UI design system the point of which is to actually restrict and standardize the look of the UI. And in this case the designer is using it as a base style but they haven't designed a system.
To build a component library, you need to be on the same page as the design team. Coordinate and let them know that you're planning to build a component library and for it to work, you need to have a design system and a set of rules around each component. If there's not this level of thought being put into the component library, I don't think it's worth pursuing.
Component libraries are useful when you're working on multiple projects across teams and they all need to follow the same design rules. They also help developers produce UI's fast because the components are prebuilt and the UI problems have already been solved. They're also great when you need to restrict developers to following a set of design guidelines.
What's your purpose of the component library?
Polaris, Shopify's component library, is built to restrict developers because they want 3rd party apps to have the same look and feel and design quality as the Shopify brand. That was their purpose to investing in a component library. Do you have a purpose like that to making a component library or does it just sound like a good idea? Stop doing things that aren't thought out.
I doubt most projects and companies are to the scale of needing a component library or have the resources to do it well.
Some popular component library examples: