component-family-consistency
Buttons, inputs, pills, badges, calendars, and other interactive components form a visual family — they share the same border-radius, colour logic, shadow scale, border style, and spacing rhythm. Inconsistency between them breaks the sense of a coherent product. Use when building or reviewing a comp
By dembrandt · 638 installs
npx skills add dembrandt/dembrandt-skills --skill component-family-consistency
Source repository · Upstream listing
Component Family Consistency
Every interactive component in a product — buttons, inputs, selects, checkboxes, radio buttons, pills, badges, tags, calendars, date pickers, sliders, toggles — belongs to the same visual family. They share a common design DNA. A user should be able to look at any component and feel that it belongs to the same product as every other component.
When components are designed in isolation without shared tokens, the product feels assembled from parts rather than built as a whole.
Reuse Before You Build a New Component
Before creating any component, audit what already exists — a new from scratch component is another mouth to feed: another entry in the family that must stay consistent (radius, height, states, motion) and another thing to maintain. Building fresh should be the last resort, not the first move. Work down this order:
1. Is there already a component that does this? Use it as is. If it almost fits, extend it with a prop or variant rather than cloning it — one flexible Button beats PrimaryButton , BigButton , and CtaButton living in parallel.
2. Is there something close in the codebase you can generalise? Often a one off was built inline for a single screen. If a small change would make it generic — lift it into the shared library, parameterise the hard coded bits (label, colour, size via props/tokens), drop the screen specific assumptions — do that instead of writing a second near identical thing.
3. Only build new when nothing existing fits and nothing can be reasonably generalised — and when you do, build it from the shared DNA below so it joins the family cleanly.
Parallel one offs — three near identical buttons, two cards with different radius — are how a design system drifts. Before adding a component, ask: does this exist, or is it one refactor from existing?
The inverse also holds: a visual treatment that appears independently in 2–3 places has earned promotion — name it and make it a shared component or token before a fourth copy appears. And when pages from different design eras disagree, migrate old toward new: the newest components are the best evidence of current intent, but confirm before deprecating a style — see [ generate ui from brand ](../generate ui from brand/SKILL.md) for the consolidation pass.
Find the inconsistency automatically (dembrandt engine, optional). Spotting where a live product has already diverged — five near identical button radii, three greys that should be one — is tedious by eye. get findings runs a design system lint over a real extraction and reports consistency and duplication issues to consolidate. (And compute drift scores how far two extractions have drifted apart — e.g. this product vs. its reference, or before vs. after a cleanup.) Use them to audit an existing product before deciding what to reuse. See [ extract design ](../extract design/SKILL.md).
The Shared DNA
Define these tokens once. Every component inherits from them.
Border Radius
All interactive components use the same base radius token. Variations are derived, not invented.
A button and an input on the same form must have the same radius. A pill is always radius full . A badge is radius sm or radius full depending on brand tone — but consistent across all badges.
Nested corners are concentric. When one rounded box sits inside another, the outer radius equals the inner radius plus the gap between them. A card with 12px padding around an 8px button needs 20px , not 12px . Get this wrong and the corners run at different curvatures a few pixels apart — nobody names it, everybody sees it.
Derive it with calc() rather than hardcoding the sum, so the corner stays correct when either token moves.
Border Style
Borders across all form components and containers should use a highly restricted set of tokens.
The 2 Step Rule: Limit border widths to at most two options (e.g., 1px and 4px , or 1px and 8px ). Do not use an incremental scale like 1px, 2px, 3px, 4px... . A limited choice makes the hierarchy clear and the product feel intentional.
An input border and a select border are identical at rest. Focus state uses border color focus everywhere. Error state uses border color error everywhere.
Spacing and Height
Components at the same visual scale share height and internal padding.
Heights and text padding are in rem so a control still contains its label when the user enlarges text; borders and shadows stay in px. See [[sizing units]].
A button and an input placed next to each other must be the same height. This is not cosmetic — mismatched heights break form layouts and signal disorder.
Set the height, do not derive it. A control sized only by padding has a height of line height + padding + border, so two controls in one row drift apart whenever any of those three differ:
an outlined variant beside a borderless one is 2px taller,
a fluid or clamped font size changes the line box at some viewports and not others,
an item whose content is an avatar or icon rather than text has a different intrinsic height.
Give every control on a line the same explicit height and centre its content. Set it as min height , so the shape holds at rest and yields rather than clips when the content is larger than you planned.
Argue this at the box model, not at the pixels. Whether a border is part of the height is box sizing , and naming that is what ends the discussion — a row debated in nudges never closes, because every participant is describing a different symptom of the same declaration. Under content box the border is added to the height, so an outlined control is 2px taller than its ghost sibling and, once centred, sits 1px off it. Under box sizing: border box — the default in Tailwind and most resets — the border is absorbed into the height, so the boxes match and a variant can gain or lose its border without moving anything.
border box moves the problem inward rather than removing it: the border now eats 1px of interior at the top and bottom, so a control whose content is not centred, or whose remaining interior is an odd number of pixels, still loses a rounding to one side. That is the 1px nobody can grep for. The fix is to keep the border in the box at all times — border: 1px solid transparent on the borderless variants — so the interior is identical whether or not a border is drawn.
A derived height is also a defect you cannot search for. An explicit height is one token you can grep and diff. A derived one is an emergent property of three separate declarations, so a row can be wrong in one control out of eight and no query finds it: in utility class codebases the same padding appears in different orders ( rounded md px 3 py 2 and rounded md border transition colors px 3 py 2 ), and a find and replace fixes some of them and silently skips the rest. Each miss is 2px, invisible on its own, and the reason the row still looks broken after you "fixed" it.
The One Way: One Class Owns the Row
Repeating the same values across siblings is how the row drifts, because every later edit has to find every copy. Declare them once instead. Every item in a row uses one shared class; that class owns the box, the content slot, and every state; an instance may set colour and nothing else.
Three rules keep it true:
1. Nothing in the row sets height, padding, font size, radius or a state on itself. If one control needs something the class lacks, add a variant to the class.
2. A variant may change colour and nothing else. The moment a variant touches the box, it is a second class pretending to be one.
3. States are edited on the class, never on one instance. This is the regression that actually happens: the boxes are built correct, then months later one sibling gets a new hover, a new focus ring or a new transition and the row splits. A single row of eight controls has one box edit and dozens of state edits over its life, so the state rule is the one that pays.
An icon's mass is not centred in its box
align items: center centres the icon's box . The drawn shape inside that box usually is not centred in it, so an icon that measures level reads low or high beside its label. A star loads its head; a download arrow loads its base. Give each icon its own offset, and do not share one nudge across a set: the correction differs per shape, and a shared value necessarily overshoots one icon and undershoots another. Two commits pushing the same row in opposite directions is the signature of a shared constant, not of one of them being wrong.
Measure it instead of nudging until it looks right. Rasterise the glyph, take the centroid of the alpha channel, and compare it to the centre of the box it will be centred in:
Bake the result into the markup as a per icon offset, name the measurement in a comment, and re measure when an icon is swapped. Two things that sound right and are not:
Blurring first rarely changes the answer. Approximating how the eye integrates mass is a reasonable instinct, but on compact solid glyphs a Gaussian blur moves the centroid by hundredths of a pixel. It earns its place only on shapes with thin extensions, which weight a bounding box without weighting the eye.
Colour does not move the centroid. On a single colour glyph, luminance scales every pixel by the same constant and the centre of mass is unchanged. Colour changes how heavy the icon reads next to the text, which is a size and weight decision, not an alignment one.
The same reasoning applies to a lone letter used as a mark, where the offset follows the letterform's mass and legitimately differs in sign between two letters.
The cursor belongs to the class too. <button renders with cursor: default in every browser, and a framework reset does not necessarily fix it: Tailwind v4's preflight does not. The cursor is the cheapest affordance a pointer user gets and the one that reads before any hover colour arrives, so a control that looks clickable and keeps the arrow reads as inert. It survives review precisely because the hover state usually is implemented and only the cursor is wrong. Verify rather than assume, since preflight contents change between majors: grep n "cursor" node modules/tailwindcss/preflight.css . An element made interactive without a native tag ( <div role="button" ) needs the cursor, a focus style and key handling; the cursor alone is the shallowest part of that.
When those controls are joined edge to edge, the family radius applies to the group, not to each child: the outer corners keep radius base and the inner joints go square, so the bar reads as one control. Collapse the shared borders to a single line too — two abutting 1px borders render as a 2px seam that no other member of the family has.
The same logic runs vertically when a control opens. A select, multiselect, date picker or combobox and the panel it drops are one seam: the trigger keeps the family radius on its top corners and squares off the bottom, the panel squares its top and carries the family radius at the bottom, so the open control reads as one taller shape rather than two stacked ones. Whatever sits at the seam — a hairline divider, a small caret notch, nothing at all — does not change the corners. The panel's border is the trigger's border continuing, at the same width and colour, and the trigger's height stays control h while it is open.
For a group that wraps several controls in one shared surface (a balance beside an avatar, a segmented control, an input with an attached button) pin the height on the wrapper and set it on the children too. Stretching alone is a layout side effect that a later align items change or an absolutely positioned child quietly removes.
Introducing the class is the dangerous step, and it fails in two specific ways. Both are silent in review and obvious on screen:
It must lose to the utilities it now sits bes