Memorisely
Design Systems

Designing component props people can use

How to turn variants, sizes and states into a small API that designers and engineers share.

Zander Whitehurst

8 min read

A component’s props are the brief. They are the list of decisions a teammate is allowed to make, written so a designer, an engineer and an AI agent can all read the same contract. Get them wrong and the component is either too rigid to use or so flexible that every screen invents a new one.

I think of props the way I think of a well made Figma component. Variants you can switch. A few sizes. Content that slots in. Everything else is closed, because an open choice becomes a new visual language by Friday.

A prop is an input with a name

In React, a prop is a value you pass in when you use the component.

<Button variant="primary" size="md" disabled={false}>
  Save changes
</Button>

variant, size and disabled are props. Save changes is the child, which is also a prop, just written between the tags. The component decides what to do with each one. The caller decides which values to send.

If you have only met this in design tools, a variant property in Figma and a prop in code are the same idea. The code version is stricter, which is the point. A string can be anything. A union of "primary" | "secondary" | "ghost" can only be those three.

Prefer a small set of named choices

Boolean props feel tidy and age badly. primary, small, danger and loading can all be true at once, and then nobody knows which combination was designed.

<Button primary small danger loading />

Replace the cluster with one prop per decision, and give each prop a short list of values:

<Button variant="primary" size="sm" tone="danger" loading>
  Delete project
</Button>
PropValuesWhat it decides
variantprimary, secondary, ghostEmphasis
sizesm, md, lgDensity
tonedefault, dangerMeaning of the action
loadingtrue, falseWhether the action is in progress
disabledtrue, falseWhether it can be used
One prop per decision. The values are the only choices a screen is allowed to make.

Two or three values is a design decision. Eight values is a menu of escapes. If a screen needs an eighth, that is a signal to look at the screen, which is the same lesson as starting with five components and growing them from real use.

Name the prop after the decision, and name the values after what the person sees or means. size="sm" describes the control. size="settings" describes a page, and it will be wrong the moment settings changes.

Children carry the content

Anything that is actual content belongs as a child or as a clearly named content prop, so the component stays reusable.

<Card>
  <CardHeader>Workspace</CardHeader>
  <CardBody>12 members · Updated today</CardBody>
</Card>

title="Workspace" is fine when the title is always a string. The moment someone needs an icon, a badge or two lines, a string prop becomes a trap and you grow titleIcon, titleBadge and titleLines. Children let the caller compose, and the card keeps its surface, padding and radius.

Slots are the same idea with names. A dialog might take title, children and footer. Naming the slot tells people where the content sits. Leaving everything as one blob of children forces every caller to rebuild the layout.

State is yours. Props are theirs.

Some data changes because the person using the product did something. Some data is chosen by the screen that placed the component. Keep them apart.

  • Props come from outside. Variant, size, the label, whether the field is invalid.
  • State lives inside. A menu that remembers it is open, a tooltip that waits for hover, a button that shows a spinner for the request it started.

If every parent has to pass open, onOpen and onClose for a simple menu, you have leaked the component’s internals. If the menu never lets a parent control it, you cannot open it from a keyboard shortcut. The practical pattern is to support both: manage it internally by default, and accept open and onOpenChange when the screen needs to coordinate.

<Menu>
  <MenuTrigger>Options</MenuTrigger>
  <MenuList>
    <MenuItem>Rename</MenuItem>
    <MenuItem>Delete</MenuItem>
  </MenuList>
</Menu>

The menu owns its open state. The screen owns the items.

What a prop should refuse

Good props make the wrong choice hard to type.

  • No raw colour. color="#16A34A" lets every caller pick a green. tone="success" stays inside the token set, and the CSS custom property behind it can move with the theme.
  • No raw spacing. padding={13} will never match the scale. padding="md" will.
  • No layout in a content component. A button should not grow a margin prop. The parent stack owns the gap. Once components accept margin, every screen has its own spacing system again.
  • No product nouns in a foundation. plan="pro" on a badge means the badge only makes sense in your pricing page. Pass tone and put “Pro” in the children. The next section of this series, the component levels, is where that line gets drawn properly.

Write the props before the styles

I ask for the prop list before anyone opens a stylesheet. It is a one page contract:

Each prop is one decision, with a list of values small enough to design for.

For each prop, write the default, the values, and one sentence on when to pick each value. That sentence is the documentation. It is also what an agent needs when it reaches for the component later. A prop called type with no comment will be guessed. A prop called variant with three named values will be used properly.

When the list starts growing past what you can hold in your head, stop adding props and look at the library. Overlapping components with overlapping props are an audit problem, and running that audit is how you find them.

Keep reading

View all
View all

Optimize your AI for better experiences, not AI slop.

View all

AI Prototyping Skills

Prototype with AI using clean UI patterns and guardrails so flows feel product-grade, not generic template slop.

$99

AI UI Motion Skills

Motion and micro-interaction patterns that make AI-built UI feel designed, polished, and trustworthy in real products.

$99

Fix AI Slop Skills

Spot AI slop early and fix type, spacing, and components so your product looks intentional, not like a template.

$99

AI Responsive Design Skills

Responsive layout patterns for rails, sidebars, and breakpoints so AI-generated UI adapts cleanly from narrow to wide.

$99

AI Dark Mode Skills

Dark theme tokens, contrast, and surfaces that keep AI-generated UI readable and product-grade, not flat gray on black.

$99

AI Color Token Skills

Neutral and primary ramps with clear steps so AI palettes stay systematic, not a random set of accent hex codes.

$99
View all