Code Component Libraries

Designers often draw components that the engineers' code library can't produce without extra work. Imagine a booking form drawn with a pill-shaped button, while the app is built on Material UI. Its buttons default to a 4 px corner and uppercase labels.

Learn on the move: press play and turn your commute, walk or drive into time that grows your design career.

· Updated November 2026 · Reviewed by Olesia Borysova, lead product designer
Share
Share

So every screen turns into a debate over details the library already decided. A code component library is the set of ready-made components engineers install or copy into a product. Designing with it in mind keeps the file and the build close.

What a Code Library Decides for You

Three kinds of library turn up in most product teams. Material UI ships finished, styled React components. Radix Primitives ships behavior and accessibility with no styles at all. shadcn/ui copies styled component code into the project, where the team owns it.

So that choice sets how much of the look you design and how much you inherit. With Material UI, one theme changes colors, type and corners across every component. With Radix, any state you leave out of the file is a state somebody has to guess.

Anatomy of a Code Library

A code library looks like a folder of components, and designers who stop there miss the parts that decide what a screen can do. Imagine an engineer telling you the booking button "already exists". You still need to know which variants, sizes and states exist with it. Here is that conversation going two ways:

Two chat threads about the booking button. Wrong: the designer draws a Tertiary button and the engineer replies that the library has no tertiary. Right: the designer asks which variants and sizes exist, and the engineer answers contained, outlined and text, in small, medium and large.

So it helps to know the parts every code library is made of. Once you can name them, you can read any library's docs in minutes and know what to ask.

The Parts of a Code Library

Most libraries share five parts, whether they come from Google's Material world or a two-person open-source project:

  • Components: the building blocks engineers place on a screen, such as Button, Dialog or Select.
  • Props (the component's settings): named options like variant, size or disabled that switch a component between its versions.
  • Theme: the shared values every component reads, such as the primary color, the font and the corner radius.
  • Behavior layer: the keyboard, focus and screen reader logic, often built on a lower-level library.
  • Docs: a page per component with live demos, a props table and notes on accessibility.

That's why "the button exists" is only the start of the answer. The props say which versions exist, and the theme says what they look like. Here are the five parts on Material UI's Button page:

Material UI's Button docs page with its parts labeled: the docs page itself, the Button component, the theme colors on the demo buttons, the props table for variant, size and disabled, and the behavior layer note that Enter and Space press the button.

Installed, Copied or Assembled

Libraries reach a project in one of three ways, and each one changes who can edit a component. Material UI is installed as a package from npm. Engineers get fixes by moving to a new version, and nobody edits the component code itself.

By contrast, shadcn/ui works the other way around. Its docs describe it as components plus a way to distribute code, which a team uses to build its own library. A command such as npx shadcn@latest add button copies the Button's source code into the project, usually under components/ui.

Because of that, the team owns every line and can change it freely. The cost is that upstream fixes no longer arrive by themselves. Radix Primitives is the third model: installed packages that ship behavior with no styles, which the team assembles into its own components. Here is how each of the three reaches a project:

Three ways a library reaches a project. Installed: Material UI with npm install, living in node_modules, with fixes arriving in a new version. Copied: shadcn/ui with npx shadcn@latest add button, placing button.tsx in components/ui for the team to edit. Assembled: Radix Primitives with npm install radix-ui, with behavior installed and styles written by the team.

Props as a Shared Vocabulary

Props are the words a designer and an engineer share when they talk about a component. Material UI's Button has three variants, text, contained and outlined, in small, medium and large. shadcn/ui's Button has six variants: default, secondary, outline, ghost, destructive and link.

So a Figma button with a "Style: Tertiary" property leaves the engineer to translate. The same button named with the library's own words, such as variant=ghost, needs no translation at all. Here is one button named both ways:

Two Figma property panels for one button. Wrong: Style set to Tertiary and Size set to Regular, so the engineer cannot tell which variant and size to use. Right: variant set to ghost and size set to sm, matching the code Button variant ghost size sm.

Reading a Component Page

The docs page shows what comes built in, which is often more than the demo shows. Radix's Dialog page lists eight parts: Root, Trigger, Portal, Overlay, Content, Title, Description and Close. Its keyboard section says Esc closes the dialog and returns focus to the Trigger. Here are the visible parts on a dialog for canceling a booking:

A Cancel this booking dialog over a bookings list, with the Radix Dialog parts labeled: the Trigger button on the booking row, the Overlay over the page, the Content box, the Title, the Description with the haircut time, and the Close button.

That matters because you don't need to design what the library already handles. You do need to design the parts it leaves open, such as how the Overlay looks and what the Title says.

Pro tip: Before you design a component, open its docs page and copy the props table into your file as a sticky note. It turns "what versions should this have?" into a list you can tick.

Found this useful? Pass it on.
Share

Why Follow DesignPath for Short Design Lessons?

Following DesignPath gives you short UX lessons, new free guides and course picks in your feed, from the team behind this page.