Component library

On this page 7

A component library is a shared, versioned collection of reusable interface components, such as buttons, form fields, dialogs and cards, that teams use to assemble products consistently. In the design workflow, the term covers both the design-side library in a design tool and the code-side library that developers import, ideally kept in close correspondence.

A component library replaces repeated one-off drawing and coding with build once, reuse everywhere. It is usually the most tangible part of a design system, which adds principles, guidelines, design tokens and governance around the components themselves.

How a component library is organized

A component library is organized in layers of increasing complexity. Small primitives are combined into larger components, which in turn are combined into patterns and templates. This structure lets a change to a primitive propagate predictably.

LayerExamplesDepends on
Design tokensColor, spacing, type scale, radius valuesBrand and platform decisions
PrimitivesIcon, text style, dividerTokens
Base componentsButton, input, checkbox, tagTokens and primitives
Composite componentsDialog, data table, navigation barBase components
Patterns and templatesSign-in form, settings page layoutComposite components
Typical layers of a component library

Each component is defined by its properties, variants and states. A button might have variants for primary, secondary and destructive use, sizes such as small, medium and large, and states such as default, hover, focus, pressed and disabled.

Design library and code library

A component library exists in two representations that must describe the same thing. The design library supports exploration and mockups, while the code library is what users actually experience in production.

AspectDesign libraryCode library
FormatComponents in a design tool filePackages in a framework such as React or Vue
ConsumersDesignersDevelopers
VersioningPublished library releases and version historySemantic versioning in a package registry
DocumentationUsage notes in the fileDocumentation site with live examples
Source of truth riskCan drift from implementationDefines real behavior and accessibility
Comparison of design-side and code-side libraries

Mature teams treat the code library as the final source of truth and keep the design library synchronized through shared naming, shared design tokens and regular audits. Mismatched names between the two are a common cause of friction during developer handoff.

Several terms in the design workflow overlap with the component library. Distinguishing them helps teams decide what to build and who should own it.

ConceptWhat it containsMain purpose
Component libraryReusable components with variantsConsistent, faster product building
Design systemComponents, tokens, guidelines, governanceShared language across the organization
Design tokensNamed design valuesSingle source for visual decisions
Style guideVisual and editorial rulesBrand consistency
Pattern librarySolutions to recurring tasksConsistent interaction design
UI kitStatic drawings of componentsQuick mockups, often third-party
Component library and neighboring concepts

A UI kit and a component library can look similar in a design tool. The difference is that a component library is maintained, versioned and tied to implementation, whereas a UI kit is usually a static starting point.

Building and maintaining a component library

A useful component library grows from real product needs. Teams usually begin with an interface inventory, which collects existing buttons, inputs and other elements and often reveals dozens of slightly different versions of the same component.

  • Start with high-frequency components such as buttons, inputs, typography and icons.
  • Define a clear API for each component: properties, allowed values and default behavior.
  • Build accessibility in at component level, including keyboard support, focus states and accessible names.
  • Document usage with do and do not examples, not just visual specifications.
  • Release in versions with change logs, so product teams can plan upgrades.
  • Run design QA on new components in real screens before declaring them stable.
ModelHow it worksSuitable for
CentralizedA dedicated team builds and owns the libraryLarge organizations with many products
FederatedProduct teams contribute under shared rulesOrganizations with strong product teams
HybridCore team curates, others contributeGrowing organizations
Common governance models

Risks and common mistakes

A component library delivers value only if teams trust it and actually use it. Most failures come from governance and communication rather than from visual design.

  • Building too much too early: rarely used components add maintenance cost without benefit.
  • Over-configurable components: dozens of properties make components hard to use correctly.
  • Detaching instances: designers who unlink components lose future updates and create drift.
  • Breaking changes without notice: unannounced changes damage trust and slow adoption.
  • No contribution path: teams that cannot propose additions build parallel libraries.

The central trade-off is consistency versus flexibility. A library that is too strict pushes teams to work around it, while one that is too loose stops guaranteeing consistency, so clear rules for exceptions are essential.

Explained without jargon

A component library is like a box of standard building bricks for apps and websites. Instead of designing a new button or form field every time, designers and developers take a ready-made piece that already looks right and works correctly.

When a piece in the box is improved, every product that uses it can receive the improvement. This saves time and keeps everything looking and behaving the same.

A typical use case

An insurance company runs a customer portal, a mobile app and an internal claims tool, each built by a different team. An interface inventory finds fourteen different button styles and five versions of the date picker, several of them not usable with a keyboard.

A small central team creates a component library with design tokens, about twenty core components in the design tool and a matching code package. Each component ships with documented variants, keyboard support and focus states, and releases follow semantic versioning.

Within the following release cycles, the three products adopt the shared components. New forms are assembled noticeably faster, accessibility issues are fixed once in the library instead of three times, and the products finally look like they belong to the same company.