Suppose three product teams need a date picker and start with the same library. A few months later, one has added date ranges, another has patched keyboard navigation, and the third has copied the component to change its styling. An upgrade now means checking three implementations and preserving each team's changes.
A design system lets teams share both the component and the decisions behind it: how it behaves, where it can vary, and who maintains it. The Figma library and npm package carry those decisions into design and code. The system stays useful only if teams can extend it and adopt its updates as their products change.
For frontend teams, that means choosing package boundaries, component APIs, a token and theme pipeline, and a way to deliver upgrades. This article works through those choices, using examples from Arco Design, ByteDance's open-source design system.
Why share a design system?
Teams building similar interfaces repeat the design reviews, interaction tests, and brand decisions as well as the code. A shared system lets them reuse that work and carry improvements across products.
Spend less time rebuilding familiar interactions
A new reporting workflow needs decisions about filters, permissions, and empty results. Reusing a date picker and dialog leaves more time for those decisions. Even if the experiment gets discarded, the team has spent less time rebuilding familiar controls.
Make common behavior dependable
A shared dialog can keep keyboard focus inside the modal, return focus to its trigger on close, and respond consistently to keyboard dismissal. A tested theme gives teams a common starting point for color contrast. When applications adopt a fix, their teams no longer need to diagnose and patch the same problem independently.
There is a cost to standardization, too. A component API that fits a settings page may be awkward in a dense trading interface. The system needs documented ways to extend a component, so a specialized layout does not require maintaining a separate implementation.
Agree on names and defaults
Design handoffs get easier when names carry the same meaning in design files and code. A Figma property size="large" can map to <Button size="large">; color.fill.secondary can map to --color-fill-secondary. The mapping needs to be documented and maintained.
Shared interaction rules also help users move between products. Having to relearn a date format or keyboard shortcut can be more disruptive than seeing a slightly different shade of blue. Decide which behaviors should stay consistent before trying to make every screen look identical.
Roll out shared changes
A versioned token package lets teams distribute a brand refresh or dark-mode update through a dependency upgrade. Each application still needs to adopt and check the release: typography or spacing changes can break layouts even when component APIs stay the same.
Versioning, visual checks, and a clear support window belong in the plan from the start.
What belongs in the system?
Start with the pieces teams repeatedly need to agree on. Tokens and components get most of the attention, but documentation and tooling determine whether those pieces stay useful.
Design tokens
Tokens give design values names that can travel between tools and platforms. Instead of repeating #165DFF, a component refers to a role such as the primary action background.
Three layers are useful once the system needs multiple themes. Each answers a different question:
| Layer | Question | Example |
|---|---|---|
| Global | What values are available? | color.blue.600 |
| Semantic | What is this value for? | color.action.background |
| Component | Where does this component use it? | button.primary.background |
A component token can reference a semantic token, which in turn references a palette value. Changing the semantic mapping lets a theme reuse the same component styles. The token pipeline and theme example below show how those references reach CSS.
UI components
A component API should make its behavior predictable: which props control state, how to supply labels, and how errors appear. Document how to customize its appearance without relying on internal markup that may change between releases.
The work behind each component varies considerably. A Badge mostly needs styling and content rules. A Select needs keyboard handling, focus management, and selection state. A Table adds sorting, filtering, selection, and sometimes virtualization: rendering only the rows near the visible area. Those differences affect how much testing and ongoing maintenance each component needs.
Icons and assets
A shared icon set gives search, download, warning, and success familiar symbols across products. Agree on each icon's meaning so teams do not use the same symbol for unrelated actions.
Consistent drawing areas and stroke weights also help icons sit comfortably beside text and controls. Generate framework components from the SVG sources so teams can reuse them. For example, Arco exposes React icons through @arco-design/web-react/icon, avoiding copied SVG markup scattered through applications.
Use currentColor in SVG fills and strokes when an icon should follow the surrounding text or status color. It can then inherit its button's color:
<Button icon={<IconSearch />}>Search</Button>
Here IconSearch comes from Arco's icon package.
Document icon meaning and labeling as well as appearance. An icon-only action needs an accessible name; a decorative icon beside a text label should not be announced a second time. Color can reinforce a status, but a label or recognizable symbol should communicate its meaning too.
Patterns that span components
A form can use the right inputs and still handle errors badly. An error-recovery pattern describes how the page preserves entered values, associates each error with its field, and moves focus after a failed submission. It captures decisions that no individual input can make for the whole form.
Searchable tables need the same kind of agreement. When a filter changes, the page must decide whether to reset pagination, clear selected rows, or disable a batch action. Document those transitions in an example teams can adapt; a screenshot shows the layout but leaves the behavior unspecified.
Documentation
An API reference tells developers which props exist. Documentation should also explain when to use a dialog instead of a drawer, how to label a destructive action, and how to recover from an error. Include layout examples, keyboard expectations, and copy that teams can reuse.
Document awkward combinations, too. A dropdown inside a modal needs rules for where its popup renders, how it stacks above the modal, and how focus moves between them. Increasing z-index alone will not resolve all three.
Tooling
Add tooling where it removes recurring manual work:
- Design tooling: Use Figma libraries and plugins to synchronize tokens between design files and Git.
- Interactive documentation: Let developers try props, inspect example code, and test interactions and accessibility.
- Lint rules: Flag hardcoded colors and deprecated props, with documented exceptions.
- Migration scripts: Use codemods, such as those built with
jscodeshift, to automate supported API changes.
Separate behavior from appearance
A control's behavior and appearance change for different reasons. Keyboard navigation may need a bug fix across every product, while a new brand may need different colors in just one. Keeping those responsibilities separate lets teams make either change without copying the whole component.
Tabs illustrate the distinction. Their functional pattern defines selection, keyboard navigation, focus movement, and the relationship between each tab and its panel, including what assistive technology exposes. Their perceptual pattern defines typography, spacing, colors, and the active indicator. A brand refresh can replace an underline with a filled background while preserving the interaction.
In code, behavior and appearance meet in a styled component, which the product composes into a screen:
Behavior and appearance meet in the shared component; task-specific content and business rules stay with the product.
The component's API connects these layers. A styled tabs component reuses behavior with different tokens; the product supplies labels and panel content. Product-specific permission checks stay in the application or a domain component.
This separation helps reviewers choose the relevant checks. A new brand color needs theme and visual checks, including contrast. A keyboard change needs interaction and accessibility checks across the styled variants. Documentation should make clear which parts products can customize and which behaviors the shared component owns.
The layers still affect each other. A compact select may reuse the same selection behavior, but reducing spacing changes the area users can click or tap, how text is truncated, and the number of visible options. Test the finished combination as well as its individual parts.
Choose package boundaries
For a new system, I would start with tokens, styled components, documentation, and one consuming application. That application tests the architecture against a real workflow before the team adds more packages.
A monorepo keeps related packages in one repository; pnpm workspaces manage their dependencies. The structure below shows where icons, primitives, and migration tools can live as the system grows. Add Turborepo when build caching and task scheduling would save enough work to justify it:
design-system/
├── packages/
│ ├── tokens/ # Raw JSON tokens + Style Dictionary transforms
│ ├── icons/ # Raw SVG assets + icon generation build pipeline
│ ├── primitives/ # Headless, unstyled accessible UI components
│ ├── react/ # Styled React components (@my-ds/react)
│ ├── eslint-plugin/ # Linter rules to enforce system adoption
│ └── codemods/ # Automated AST upgrade scripts
├── apps/
│ ├── docs/ # Next.js / Contentlayer documentation website
│ └── storybook/ # Component isolation & visual regression sandbox
├── package.json
├── pnpm-workspace.yaml
└── turbo.json
Keep framework dependencies explicit
A separate tokens package can serve iOS, Android, email templates, and web apps without pulling in React.
A primitives package has a different boundary. It separates behavior from styling, but headless React components still depend on React. Token data and state-transition logic may be shareable across frameworks; rendering, events, refs, and lifecycle integration still need framework-specific implementations.
Choosing primitives
Headless primitives supply interaction behavior while leaving visual styling to the consuming application. Before building a control, check how much behavior an existing primitive can cover. Styling a dropdown usually takes less work than implementing its keyboard and focus behavior.
- Overlays and complex controls: Prefer established primitives when their behavior fits your requirements. Radix Primitives provides React components with interaction behavior; Floating UI provides positioning utilities and, in its React package, interaction hooks. Positioning alone does not implement an accessible dialog or combobox.
- Simple controls and layout: Prefer native elements for buttons and inputs, adding tokens and a focused API. Build custom behavior only when the native control cannot meet the requirement.
Decide what to own
| Approach | Good fit | Ongoing responsibility |
|---|---|---|
| Existing styled library plus a brand layer | Most workflows fit an established library | Theme integration, upgrades, and product-level accessibility |
| Headless library plus custom styles | Brand and composition need more flexibility | Styling, API adapters, and integration tests |
| Custom primitives | Documented requirements cannot be met through composition | Behavior, assistive technology testing, browser support, and maintenance |
Test these options against a real product workflow and record where they fall short. Before building custom primitives, identify the requirements they must meet, their owner, and the maintenance budget.
Design component APIs
A component API defines who owns state, which parts consumers can arrange, and how the component can vary. Keep those choices consistent across controls so teams can predict behavior without learning a new contract for every component.
Controlled and uncontrolled state
In controlled mode, a form control reads the parent's value prop and reports user changes through onChange. In uncontrolled mode, it stores the value internally, initialized from defaultValue:
In controlled mode, the parent decides whether to update the value. In uncontrolled mode, the component stores the new value itself.
Both modes can report changes through onChange, but only controlled mode requires the parent to supply a new value before the visible selection changes. Updating defaultValue after initialization does not reset an uncontrolled control.
<Select value={department} onChange={setDepartment} />
<Select defaultValue="infra" />
These are alternative usages. Keep the chosen mode stable for the component's lifetime, and define reset behavior separately. A shared hook can enforce the contract; Arco's useMergeValue is one implementation to study.
Compose form fields
Composition means building a larger component from parts that consumers can arrange. Arco's Form.Item, for example, keeps a field's label and configuration beside its input, without requiring the form to accept a prop for every possible field layout:
<Form form={form}>
<Form.Item field="username" label="Username">
<Input />
</Form.Item>
</Form>
When to add a prop or feature
A request for a new prop often starts with one screen. Decide whether it represents a reusable capability or a product-specific arrangement. Every prop adds combinations to document, test, and support during upgrades.
Use the kind of change to choose the extension point:
- A visual choice such as compact density belongs in a named variant or token when its meaning is consistent across products.
- A reusable behavior, such as a clearable selection, may justify a prop with a defined state and event contract.
- A custom header, footer, or action area usually fits a slot—a place for consumer-provided content—or a child component better than several booleans that rearrange the internals.
- Business rules, such as who can approve an invoice, belong in a product component composed from shared controls.
For example, showExportButton, showOwnerFilter, and showApprovalAction would turn a shared Table into a particular product's toolbar. Keep the table focused on data presentation and selection, and compose the toolbar beside it. A selection feature belongs in the table API when it needs access to the table's row state.
Ask for concrete usage examples and try expressing them with existing parts. Independent requests strengthen the case for a shared feature; an accessibility fix should not have to wait for a second request. Before accepting a feature, identify its owner, valid combinations, and failure states. If those combinations are difficult to explain, consider a separate component or a smaller composable part.
Build tokens and themes
Choose one authoritative token source and generate downstream formats. A small web-only system can begin with CSS variables. When several tools or platforms need the same values, a token build makes the transformations explicit:
The same token source can produce several outputs; each platform receives the format it needs.
Generate platform outputs
For cross-tool exchange, the DTCG 2025.10 format defines token types and values. It is a Community Group specification, not a W3C Standard. A dimension token is enough to illustrate the shape:
{
"space": {
"$type": "dimension",
"$value": { "value": 16, "unit": "px" }
}
}
A CSS transform can turn this token into --space: 16px. An alias is a reference to another token, so resolving aliases requires the complete token set. The build may preserve those links as CSS variable references when configured to do so.
With Style Dictionary v5, instantiate new StyleDictionary(config) and await buildAllPlatforms(), as described in the API reference. Configure only the outputs consumers need: css/variables for web styles, and JavaScript plus companion declaration formats when code needs the values. Check the format reference for outputs and the v5 migration guide when upgrading an existing pipeline.
Decide how themes are applied
A theme groups values for a brand, color mode, or density setting. Decide which choices are fixed for an application build and which users can change while the page is open. Compiled styles work for fixed values; CSS custom properties let components pick up runtime changes through normal CSS inheritance.
Arco illustrates this combination: Less produces stylesheets, while components also reference variables such as --color-primary-6. Its dark-mode selector can be activated with document.body.setAttribute('arco-theme', 'dark'). DesignLab adds a distribution workflow: configure theme values in an editor, publish a versioned theme package, and import it in consuming applications. This gives teams a versioned artifact to adopt and check, just as they would a component release.
Document the supported combinations, such as a brand in light and dark modes. Define which values take precedence when themes overlap, so a product team can tell what an update will change before adopting it.
Follow a token through a scoped theme
The palette provides raw values, the semantic layer chooses a value for each theme, and the component consumes that role. Here is the path for a primary button:
Light and dark themes change the semantic mapping while the button keeps the same CSS rule.
The corresponding CSS can stay small. Palette definitions are omitted here so the theme boundary is visible:
[data-theme='light'] {
--action-bg: var(--blue-600);
}
[data-theme='dark'] {
--action-bg: var(--blue-300);
}
[data-theme] {
--button-bg: var(--action-bg);
}
.button-primary {
background: var(--button-bg);
}
Declare the component alias at each theme boundary. If --button-bg were declared only on an ancestor, it would resolve --action-bg there. Changing --action-bg in a nested theme would not update that inherited alias.
Keep overlays inside the intended theme
A React portal renders content at a different location in the document's element tree, or DOM. CSS inheritance follows that tree, not the React component hierarchy. A dialog opened from a dark panel can therefore inherit light colors if its portal renders under the light page body:
The two branches show alternative DOM locations for the same dialog. Its rendered location determines which theme it inherits.
Choose a host inside the themed region, or apply the same theme selectors and token overrides to a host under document.body. Radix Dialog's portal container is one API for choosing that DOM location.
A host inside the panel inherits its theme, but an ancestor's clipping or CSS transforms may constrain the overlay. A themed host under the body avoids those ancestors. Check both overlay placement and theme inheritance when choosing the host.
Check what a theme provider actually changes. Arco's React ConfigProvider theme implementation writes colors to document.body, so nesting these providers does not isolate their CSS themes.
Publish and test the package
Test the published package from an application that imports it. Check whether importing one component pulls in every stylesheet, whether React has been bundled into the library, and whether the build preserves client directives such as 'use client'.
Define public entry points
Prefer ECMAScript modules (ESM) for modern applications. Add CommonJS, the older Node.js module format, when a supported consumer needs it, with matching TypeScript declarations for each format. Define the package entry points and dependency expectations:
| Package setting | Purpose |
|---|---|
exports | Expose the JavaScript entry, its declarations, and a public CSS entry |
peerDependencies | Declare the React versions consumers must provide |
sideEffects | Preserve style imports and any JavaScript with initialization effects |
| Build externals | Keep React and its subpath imports out of the library bundle |
For example, consumers should be able to import the component and its stylesheet through stable public paths:
import { Button } from '@my-ds/react'
import '@my-ds/react/css'
Check the built output
- Preserve CSS and Less imports in
sideEffects. Audit JavaScript modules before declaring them free of side effects; registration code needs explicit treatment. - Declare React as a peer dependency and configure the build tool to externalize
react,react-dom, and their subpath imports. Peer declarations alone do not prevent bundling. - Inspect a small consumer build: named ESM imports do not guarantee that CSS is split per component.
Server rendering and theme initialization
Treat server rendering as a consumer requirement. Radix supports server rendering, but interactive components still need client-side event handling. In the Next.js App Router, keep client boundaries around interactive entry points instead of making the entire library a client module. Ensure the build preserves those directives.
Avoid reading window, document, or localStorage during server rendering. Derive an explicit theme from a cookie when the server can access the preference; otherwise use a framework-supported theme initialization strategy before paint. For a system preference, CSS prefers-color-scheme can provide the initial appearance. Keep the initial client render consistent with server markup, and test hard reloads for theme flashes and hydration errors.
Publish a server-rendered consumer example alongside Storybook. Include an interactive control, a themed portal, and a persisted theme preference so package and hydration regressions surface before release.
Testing shared behavior
Test the package in isolation and in a consuming application. Component tests catch state and interaction errors; consumer tests expose packaging, theme inheritance, and hydration problems that an isolated story may miss.
Use unit and interaction tests, such as Vitest with React Testing Library, for user events, controlled and uncontrolled state, and keyboard behavior. For a labelled select, focus the trigger, press Enter, and check that the listbox opens. Test selection and focus restoration separately so a failure points to the behavior that broke.
Run automated accessibility checks with axe in component tests and real browsers. The axe-core documentation notes that color-contrast checks do not work under JSDOM, the simulated DOM often used in unit tests. Include manual keyboard and screen-reader checks of complete workflows; an automated scan cannot establish conformance on its own.
Visual regression tests compare screenshots to detect unintended changes. Playwright and Storybook can cover hover, focus, disabled, and dark-mode states on each pull request. Review the differences: a screenshot comparison detects changed pixels but cannot decide whether the change is appropriate.
Keeping the system usable
The package can be well designed and still lose adoption. A missing variant, an unanswered issue, or an expensive upgrade gives a product team a reason to copy a component locally. Once that copy starts changing, the next system fix no longer reaches it.
Ownership and adoption
Assign each stable component an engineering owner and a design owner. Publish its maturity, supported environments, accessibility expectations, and support window. Product teams need a contribution path with a review deadline; otherwise local forks become the fastest way to ship.
Track which applications use supported versions and how long upgrades take. Local overrides and recurring accessibility defects reveal problems the shared system has not solved. Usability testing of common tasks adds another view: a widely adopted component can still be difficult to use.
Use that evidence to prioritize fixes. Review components with no clear owner or active use case before deciding whether to maintain, replace, or retire them.
Preventing component divergence
Make it practical to request changes before adding rules against local alternatives:
- Linting guardrails: Write custom ESLint rules to warn developers when they use inline colors (
color: '#165DFF') instead of design tokens, with exceptions for charts, third-party integrations, and system internals. Keep native HTML available when the shared component does not fit the task. - Contribution proposals: Give product teams a documented process for requesting components or variants. If several products need a timeline, the core team can compare their requirements and decide which behavior to share.
Breaking changes and automated migrations
An upgrade that requires edits across dozens of files competes with product work. Give teams a migration path before removing an API:
- Mark the old API with
@deprecatedin TypeScript docstrings and publish its support window. - Document the replacement and provide compatibility shims where feasible.
- Automate supported changes with a codemod, using a tool such as
jscodeshift. Document cases that require manual review.
For example, suppose a library moves a button's danger styling from type to status:
// Before
<Button type="danger">Delete</Button>
// After
<Button status="danger">Delete</Button>
A codemod rewrites source code automatically. To make this change safely, it must check where Button was imported from and whether a local variable shadows that name. Matching the JSX name alone could change an unrelated component:
An import alias should still match; a local variable with the same name should not. Skip boolean attributes, expression values, unsupported namespace imports, spreads, and existing status props unless the transform explicitly handles them. Use fixtures for each case, and verify that running the migration twice produces no further changes.
Pilot the migration in one application, review the diff, and compare affected screens before rolling it out to more teams.
Where I would start
Pick one workflow that two product teams already share, such as a searchable table with an edit form. Build it with the proposed tokens and components. Change its theme, check keyboard behavior, and upgrade its package version. Record where the teams need local overrides or clearer documentation.
Use those difficulties to choose the next piece of shared work. Each abstraction should solve a problem the teams can describe and have an owner who can respond when their requirements change.