Building a Custom Component Library – Fast

Rate this content
Bookmark

If your company is anything like the ones I’ve worked for, you have apps with seven different button designs, three different datepickers, and a bizarre collection of dropdowns that may or may not be accessible. A growing trend to deal with this inconsistency is to build a custom design system or component library. Essentially, you build The One Way™ to create a datepicker for your organization, and ask that the rest of your company to conform to your new system. But building a component library comes with a lot of challenges, like, which frameworks or libraries should you use (if any)? How do you make sure your components are accessible? And how to you distribute your components so your whole company can use them? In this lightning talk you’ll learn how to build a component library fast building on top of a library like Kendo UI. You’ll learn tips & tricks on how to get up and running, how to customize components, and how to distribute components throughout your organization.

This talk has been presented at JSNation Live 2021, check out the latest edition of this JavaScript Conference.

FAQ

A component library in UI design is a collection of reusable UI controls such as buttons, inputs, daypickers, and autocompletes that ensure visual and functional consistency across an organization's applications.

A company should have its own UI component library to maintain consistency in design and functionality, streamline technology choices, and enhance accessibility across all its digital products.

Building complex components such as date pickers involves addressing multiple challenges including ensuring accessibility, mobile responsiveness, compatibility with technologies like TypeScript, and providing clear documentation for ease of use and extensibility.

Companies should avoid building complex components themselves because these tasks are time-consuming and can detract from focusing on unique business goals. Utilizing established libraries can save time and ensure high-quality, tested solutions.

Using framework-specific component libraries offers better performance, smaller bundle sizes, and improved ergonomics tailored to specific development environments, leading to higher productivity and success in projects.

A development environment for UI components should be set up outside of existing applications and include a space for component development, a demo application for live testing, and scripts for packaging and distributing the components.

When choosing a third-party UI component library, look for comprehensiveness, accessibility, compatibility with preferred frameworks or toolchains, and extensibility to ensure the components can be adapted to various needs.

TJ VanToll
TJ VanToll
8 min
09 Jun, 2021

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today, I want to talk to you about building custom component libraries fast. Every company should have its own standard set of UI controls for consistency in design, technology, and accessibility. Companies shouldn't build the harder parts of those libraries themselves, such as date pickers and data grids. But as a software developer, your time is valuable. Building custom component libraries is a better use of your time than reinventing the wheel.

1. Building Custom Component Libraries

Short description:

Today, I want to talk to you about building custom component libraries fast. Every company should have its own standard set of UI controls for consistency in design, technology, and accessibility. Companies shouldn't build the harder parts of those libraries themselves, such as date pickers and data grids. These components require careful consideration of accessibility, mobile compatibility, documentation, and extensibility.

Hi everybody. I'm TJ, and today I want to talk to you about building custom component libraries fast. And by component libraries, I essentially mean a series of UI controls that can be anything from buttons and inputs to more complex things like daypickers and autocompletes.

Now, me personally, I've been building component libraries like this for a long time, maybe too long. Back in the day, I was a member of the jQuery UI team, if you remember that. I still have this sweet hat to show for it. And more recently, I'm now a member of the KendoUI team. And because I've been doing this for many years, I've developed a series of opinions or hot takes about component libraries that I'm going to start by sharing, because I think you'll find them interesting and also useful.

And then I'll move on from that to show how you can put these things into action and give you some recommendations on how you can build your own component library. So to start, my first sort of opinion or hot take is that I think every company, I think your company should have its own standard set of UI controls. And the reason for this is really consistency. So you apply some visual consistency so that instead of having 30 different button designs, you create a button in a component library that sort of has the one true way of building buttons for your organization. But you also get consistency in terms of things like technologies. Say a component library is sort of a forcing function to choose, help you choose a limited set of text that you want to push out and sort of promote throughout your organization. You also get consistency in terms of accessibility. Accessibility can be hard, but if you can get it right within the components within your library, you can sort of then spread those accessibility benefits to other parts of your organization. So I think every company should have its own UI component library.

And I also think that companies shouldn't build the harder parts of those libraries themselves. And by complex components here, I'm not talking things like inputs and buttons. I'm talking about the harder stuff. The date pickers, combo boxes, auto-completes, data grids, things like that. Because these components are harder than they might first seem. So take the date picker for example. And you don't just have to build a calendar here. When you're building a reusable component, you have to take into account all sorts of other things. How are you going to make this accessible? How are you going to make sure it works like you expect on mobile, that TypeScript works, that you're going to document all of this so other people understand what you did and that it's extensible and all of these things. And these are solvable problems. You watching this, I can see it through the camera. You are a smart person. These are problems you can solve.

2. Component Libraries for Efficient UI Development

Short description:

But as a software developer, your time is valuable. Building custom component libraries is a better use of your time than reinventing the wheel. Companies should have their own libraries and use framework-specific components. Compatibility comes at a cost, and it's usually outweighed by performance, bundle size, and framework ergonomics. The Kendo UI team has built separate libraries for different frameworks. Start by setting up a development environment and use a go-to library for complex widgets. Look for comprehensiveness, accessibility, framework-specific components, and extensibility.

But you as a software developer, also your time is very valuable. Your time is almost always better spent on things that are unique to whatever it is your business is doing, than reinventing the wheel and solving some of these UI component problems that have been solved by a lot of libraries for a long period of time. It's just a better use of your time.

So I think companies should have their own component libraries. I think you should not build the harder parts of these libraries yourself. And I also think that you should lean towards using components that are specific for a framework that you like to use, like a framework like Angular, Vue, and React, than a framework that's sort of framework agnostic and tries to work across the board.

Now, this is a hot take that I share with Brandon Dale, an ex-member of the React team. I think he phrased his explanation more elegantly, so I just stole a quote from him. He says that compatibility always comes at a cost, and that cost is always going to be something like performance or bundle size or framework ergonomics. And in the majority of cases, those things are going to be more important than the compatibility itself.

Now, this is something we believe quite strongly on the Kendo UI team, so strongly, in fact, that we've built four separate component libraries for different frameworks. And we do this because, as you might imagine, it's quite a bit of work because our users consistently tell us that they are more successful, they are more productive when they use components that are built for their framework of choice specifically.

So I think companies should have their own standard set of UI components. I think they shouldn't build the harder parts of that themselves. And I think that, in most cases, you should lean towards using components that are built for your framework, for your tool chain of choice.

So how do you take these things and put them into action? Well, I recommend starting by just setting up a development environment that you can use to build components in a place that lives outside any of your existing apps. So what I like doing is I like to have an environment where I can both develop on the components and then also have a demo application where I can then test those components in a live running app and see how they work. And then also having a few scripts that let me take my components when I'm all set with them, package them up, bundle them up, and distribute them so that they can be used throughout my organization. And I'll give a link, if you're interested in this, at the end of this talk, so that if you want to see my preferred workflow in detail, you can walk through that. But just start by having this development environment.

And from there, I would then recommend having a go-to library that you're going to reach to for some of these more complex widgets or really anything that you don't want to build yourself. And for that, I would look for a handful of things in this third party library. I would start by looking for comprehensiveness. You don't want to be pulling components from five different places throughout the Internet and trying to make them together. Usually you'd have one library that provides as much of this as possible. You want to look for accessibility because, again, you want to bake in good accessibility to your components by default. You want to look for framework-specific components or at the very least something that works really well with the tool chain that you like using. And you also want to look for extensibility. The thing about a component library is that people are going to find ways of using your components in a lot of different ways. So you want to find third party components that are very adaptable that you can tweak and theme and change things about every little piece of them.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Design Systems: Walking the Line Between Flexibility and Consistency
React Advanced 2021React Advanced 2021
47 min
Design Systems: Walking the Line Between Flexibility and Consistency
Top Content
The Talk discusses the balance between flexibility and consistency in design systems. It explores the API design of the ActionList component and the customization options it offers. The use of component-based APIs and composability is emphasized for flexibility and customization. The Talk also touches on the ActionMenu component and the concept of building for people. The Q&A session covers topics such as component inclusion in design systems, API complexity, and the decision between creating a custom design system or using a component library.
Towards a Standard Library for JavaScript Runtimes
Node Congress 2022Node Congress 2022
34 min
Towards a Standard Library for JavaScript Runtimes
Top Content
There is a need for a standard library of APIs for JavaScript runtimes, as there are currently multiple ways to perform fundamental tasks like base64 encoding. JavaScript runtimes have historically lacked a standard library, causing friction and difficulty for developers. The idea of a small core has both benefits and drawbacks, with some runtimes abusing it to limit innovation. There is a misalignment between Node and web browsers in terms of functionality and API standards. The proposal is to involve browser developers in conversations about API standardization and to create a common standard library for JavaScript runtimes.
Composition vs Configuration: How to Build Flexible, Resilient and Future-proof Components
React Summit 2022React Summit 2022
17 min
Composition vs Configuration: How to Build Flexible, Resilient and Future-proof Components
Top Content
Today's Talk discusses building flexible, resilient, and future-proof React components using composition and configuration approaches. The composition approach allows for flexibility without excessive conditional logic by using multiple components and passing props. The context API can be used for variant styling, allowing for appropriate styling and class specification. Adding variants and icons is made easy by consuming the variant context. The composition and configuration approaches can be combined for the best of both worlds.
Building Cross-Platform Component Libraries for Web and Native with React
React Advanced 2021React Advanced 2021
21 min
Building Cross-Platform Component Libraries for Web and Native with React
Top Content
This Talk discusses building cross-platform component libraries for React and React Native, based on a successful project with a large government-owned news organization. It covers the requirements for React Native knowledge, building cross-platform components, platform-specific components, styling, and the tools used. The Talk also highlights the challenges of implementing responsive design in React Native.
Walking the Line Between Flexibility and Consistency in Component Libraries
React Summit 2022React Summit 2022
27 min
Walking the Line Between Flexibility and Consistency in Component Libraries
This Talk discusses the comparison between Polaris and Material UI component libraries in terms of consistency and flexibility. It highlights the use of the action list pattern and the customization options available for the action list component. The Talk also emphasizes the introduction of a composite component to improve API flexibility. Additionally, it mentions the importance of finding the right balance between flexibility and consistency and the use of types to enforce specific child components.
Find Out If Your Design System Is Better Than Nothing
React Summit 2022React Summit 2022
20 min
Find Out If Your Design System Is Better Than Nothing
Building a design system without adoption is a waste of time. Grafana UI's adoption is growing consistently over time. The factors affecting design system adoption include the source mix changing, displacement of Homebrew components by Grafana UI, and the limitations of Grafana UI's current state. Measuring adoption is important to determine the success of a design system. The analysis of code through static code analysis tools is valuable in detecting and tracking component usage.

Workshops on related topic

Build a Data-Rich Beautiful Dashboard With MUI X's Data Grid and Joy UI
React Summit 2023React Summit 2023
137 min
Build a Data-Rich Beautiful Dashboard With MUI X's Data Grid and Joy UI
Top Content
WorkshopFree
Sam Sycamore
Siriwat (Jun) Kunaporn
2 authors
Learn how to put MUI’s complete ecosystem to use to build a beautiful and sophisticated project management dashboard in a fraction of the time that it would take to construct it from scratch. In particular, we’ll see how to integrate the MUI X Data Grid with Joy UI, our newest component library and sibling to the industry-standard Material UI.
Table of contents:- Introducing our project and tools- App setup and package installation- Constructing the dashboard- Prototyping, styling, and themes - Joy UI features- Filtering, sorting, editing - Data Grid features- Conclusion, final thoughts, Q&A
Should we have business logic in the UI?
JSNation 2022JSNation 2022
148 min
Should we have business logic in the UI?
WorkshopFree
Samuel Pinto
Samuel Pinto
How many times did you say or hear “this is business logic, it should not be here”?In this workshop, we will create a modern frontend application using old patterns and you will learn how to build apps that have decoupled UI and services.We will start with a React application that has its whole logic in the UI. Then step by step we will extract the rules and operations to hit that sweet spot of independence.
Learn To Use Composables: The Swiss Army Knife Of Vue Developers
Vue.js Live 2024Vue.js Live 2024
163 min
Learn To Use Composables: The Swiss Army Knife Of Vue Developers
Workshop
Juan Andrés Núñez Charro
Juan Andrés Núñez Charro
Composables (composition functions) are stateful/stateless functions that can leverage Vue's reactivity API, decoupling it from components.This shift in perspective opens the possibility for tackling common scenarios in a new and creative way. In this workshop, you will learn how to solve typical problems every Vue developer faces, using composables:
- Data store;- Component cross-communication;- Utility functions (DOM, API, etc);And more.