# Component: The Reusable Building Block of a Design System

> Learn what a component is, how variants and states define it, and why teams build one button once and reuse it everywhere.

**In short:** A component is a reusable, self-contained piece of interface that a team builds once and reuses everywhere, holding its own shape, text style, colors and behavior.

From "Design systems", a free course by Venkat R. Murty: https://designervenkat.online/learn/design-systems/component

## What you will learn

Every screen you design is made of small parts: buttons, text boxes, menus and links. In a design system, the most important of these parts are called components. This lesson explains what a component is, what it is made of, and what makes one good. By the end, you should be able to explain why a team builds a button once instead of drawing it again on every screen.

- **Component:** A reusable piece of interface that a team defines once and then uses again, such as a button or an input field.
- **Interface:** The part of a product that people see and touch, such as screens, menus, buttons and text boxes.
- **Variant:** A named version of one component, such as a primary button or a secondary button.
- **State:** The look a component takes at a given moment, such as normal, hovered, focused or disabled.
- **Design decision:** A choice about color, type (the style and size of text) or spacing (the gaps between parts).
- **Single source of truth:** One official place where a component is stored, so every copy follows the same version.

## What is a component?

A component is a reusable, self-contained piece of interface. Self-contained means the piece holds its own shape, text style, colors and behavior inside one unit. A team builds it once, writes down its rules, and then places it on many screens.

Not every element on a screen is a component. A UI element is the visual and interactive concept, for example a primary button. The component is the agreed, defined version of that idea that the team can reuse.

Components can be small or large. A button, a search bar, a navigation menu, a modal dialog — each is a UI element with a specific purpose. The test is not the size of the piece. The test is whether the team defines it once and reuses it with the same rules.

## Structure, variants and states

A component needs a clear definition, or every designer will build it a little differently. A useful definition covers three things. A UI component is a reusable interface element with predefined parts, variants and states, so it can be built without guesswork.

- **Structure:** The parts of the component and how they fit together. Writing these parts down means every copy has the same parts.
- **Variants:** Named versions of the same structure, such as primary and secondary, or small and large. A variant is a version the team has agreed to support.
- **States:** The look the component takes in each situation, such as default, hover, focus, disabled and error. Each state tells the user something about what is happening.

### What are variants?

Variants let one component cover several real needs. This keeps the library tidy. A designer picks the version they need instead of inventing a new button.

Variants can change size, style or emphasis. One example lists sizes like small, medium and large, styles like primary, secondary and ghost, and states like default, hover and disabled. A variant is a version the team plans and approves. A one-time change for one screen is not a variant.

### What are states?

A state shows what a component is doing right now. Component states refer to the different visual appearances that a UI element can have based on user interaction or system status. Designers draw each state so a person can tell whether an element is ready, being touched, or unavailable.

- **Default:** The normal look when nothing is happening to the component.
- **Hovered:** The look when a mouse pointer rests on the component, which tells the user it can be clicked.
- **Focused:** The look when the component is selected with a keyboard or another tool, so the user knows where they are on the screen.
- **Disabled:** The look when the component cannot be used at the moment, often shown faded so it does not invite a tap.
- **Error:** The look when something is wrong, such as a text box that holds an invalid entry.

Some teams add more states. The exact list depends on the team, but the main idea stays the same: every state is drawn and named, not left to chance.

## Built from design decisions

Components are made from design decisions. A team chooses a color, a text style and a spacing value, then places those choices inside the component.

Because the choices live inside the component, a designer who uses it does not need to pick a new blue or a new gap each time. In a design system, components hold their structure and behavior while they draw on shared styles. The result is that the same button looks the same on every screen.

> **Tip:** When you look at a component, ask three questions: which color did the team choose, which text style, and which spacing? Those answers are what the component is made of.

### Combining small pieces

Components can also be combined into larger pieces. A search bar is a good example. It is made from an input field, a short label and a button, placed together in a set order.

1. **Start with the input field:** This is the box where a person types the words they want to search for.
2. **Add the label:** A short piece of text that tells the person what the box is for.
3. **Add the button:** The button that starts the search. It should be the same button component the rest of the product uses.
4. **Set the arrangement:** Decide the order and spacing once, so every search bar in the product looks and behaves the same way.

### Why are components the working layer?

A design system has many parts. Components are the parts that designers pick up when they build real screens. That is why they are called the working layer. The other parts explain and support them, but the components are what people place on the page.

## What makes a good component?

Not every button in a product is a good component. A good component has clear rules, enough flexibility to cover real needs, and one official source that controls it.

- **Clear rules:** The team writes down what the component is for, when to use it and when not to use it.
- **Flexible, not custom:** It covers real needs through its variants, so no screen needs a private copy.
- **One source of truth:** There is one official version, and a change to it reaches every screen that uses it.

### Say when to use it and when not

A component should come with usage rules. The element is described once, with its parts, variants, states and usage rules, and then the team simply reuses it. The usage rules are often the most useful part for a new designer, because they turn a shape into a decision.

A good example is the rule about the main button. When a team writes a rule like this, a designer knows not to add a second bold button to a screen, even if the second button seems useful.

> **Tip:** For every component, write one line that starts with 'Do not use this when…'. A clear 'do not' line makes misuse easy to spot in a review.

### Flexible, but not custom for each screen

A good component must cover real needs without being bent for every screen. When a screen needs something new, the team should first ask whether an existing variant fits. Adding a variant for many screens is better than making one-off copies that drift apart over time.

Flexibility has a limit. A component with dozens of options is hard to understand and hard to use. Keep only the options that real screens need, and remove the ones nobody uses.

### Why is one source of truth important?

A component should have one official version. This is the single source of truth. If the team fixes the color of a Submit button in one place, every screen that uses that component gets the fix.

Without one source, the same button is copied and changed many times. Each copy starts to drift, and fixing one copy does not fix the others. A single official version prevents this drift.

## Worked example: the Material 3 button

Google's Material Design 3 system is a useful real example. Its all-buttons page lists elevated, filled, filled tonal, outlined, text, icon and segmented buttons, among others. Follow the steps below to see how one button family works as a component.

1. **Start with emphasis:** Material sorts buttons by how much attention they should get. High emphasis is for the primary, most important, or most common action on a screen, while low emphasis is for optional or supplementary actions.
2. **Choose a variant:** A filled button is the strongest version and suits the primary action.
3. **Check the states:** States are visual representations used to communicate the status of a component or interactive element.
4. **Apply the usage rules:** Use one filled button for the main action on a screen.
5. **Respect the touch size:** Small icon buttons need room to be tapped.

Why does this work as a component? The team defines the variants, states and rules once. A designer placing a Material button does not invent a new blue, a new hover look or a new rule. If the team later changes the component, the change follows the single official version into the screens that use it.

## Check yourself

Try these two short scenarios. Each one asks you to use the ideas from this lesson.

**Quick check:** Your app has five Submit buttons in slightly different blues, and each one was drawn by a different designer. Which change fixes the problem most directly?

A. Ask each designer to keep the blue they like best, so the team stops arguing
B. Build one Submit button component with defined variants and states, and require every screen to reuse it
C. Make every Submit button larger so the small color differences are harder to see

**Answer:** B. One defined component stores one set of choices, so the color and states stay the same everywhere. The team should also write the variants and usage rules so everyone uses it the same way.

**Quick check:** A product team has a button component with primary, secondary and ghost variants. One designer needs a red delete button on a single screen. What should the designer do?

A. Copy the button, change its color to red, and keep the copy for that screen only
B. Check whether an existing variant fits, and if none does, ask the team to consider adding a variant
C. Draw a red box that looks like a button but is not built from the component

**Answer:** B. The team's component should cover real needs through its variants. Asking for a new variant keeps one official version, while a one-off copy starts to drift away from it.

## Key takeaways

- **Defined once:** A component has parts, variants, states and rules written down before anyone reuses it.
- **Built from choices:** Color, type and spacing decisions make up the component, so the same choices appear everywhere.
- **Rules before use:** A good component says when to use it and when not to use it.
- **One place to change:** A single official version means one fix reaches every screen that uses the component.

## Sources

- [Material Design 3: All buttons](https://m3.material.io/components/all-buttons)
- [Material Design 3: Buttons specs](https://m3.material.io/components/buttons/specs)
- [Material Design 3: Segmented button specs](https://m3.material.io/components/segmented-buttons/specs)
- [Medium: An overview of buttons in UI design](https://medium.com/design-bootcamp/an-overview-of-buttons-in-ui-design-68495979ae51)
- [Medium: One Screen, One Primary Button (Material 3 hierarchy)](https://medium.com/@alikasem/one-screen-one-primary-button-material-3-button-hierarchy-in-angular-material-b8953ea58cad)
- [Medium: UX Blueprint, component states guideline](https://medium.com/design-bootcamp/ux-blueprint-07-components-state-a-friendly-guideline-on-how-to-use-it-5ad549de05f1)
- [UXPin: 10 Essential Design System Components](https://www.uxpin.com/studio/blog/design-system-components/)
- [UXPin: UI Elements that Every Designer Must Know](https://www.uxpin.com/studio/blog/user-interface-elements-every-designer-should-know/)
- [Uxcel: User Interface (UI) Components glossary](https://uxcel.com/glossary/ui-components)
- [nhimg: What Is UI Components? Definition and Examples](https://nhimg.org/glossary/ui-components/)
- [Honcho: Component (in Design System) glossary](https://honcho.agency/design-systems/glossary/component)
- [Sigma Collection: Component Variants in Design Systems](https://www.thesigma.co/journal/component-variants-design-system)
- [Penpot: How to use component variants to scale your design system](https://penpot.app/blog/how-to-use-component-variants-to-scale-your-design-system/)
- [InterLAB: UI component anatomy, button, input, card and their states](https://interlab.app/en/blog/ui-komponenty-sostoyaniya)
