Full answer
This is a decision and organisation question, not only a technical one. Structure the answer in steps.
- Clarify goals: consistency across apps, faster delivery, accessibility compliance, brand identity, and who will maintain it. Count how many teams and apps will use it, and which frameworks (all Angular, or others too).
- Options:
- Use an existing library as is (Angular Material, PrimeNG, Spartan or similar). Fast, accessible, well tested. Cost: the look follows the library, deep customisation can be painful, and you depend on its release plan.
- Build a custom design system on the CDK. Full control of look and behaviour, and the CDK gives accessible primitives (overlay, a11y, listbox, menu, drag-drop). Cost: a team to maintain components, docs and accessibility.
- A hybrid (most common): adopt Material or CDK primitives, theme them with your design tokens, and wrap them in your own components (
school-button,school-form-field) so apps depend on your API, not the underlying library. You can replace pieces later. - Web Components (Angular Elements or a Web Component library like Lit or Shoelace) when apps use different frameworks.
- Decision criteria: brand distance from Material, accessibility requirements, team capacity (a design system needs at least a small dedicated team), release speed, and the cost of switching later.
- Build:
- Design tokens first (colour, spacing, type, radius), as CSS custom properties, owned with designers.
- A workspace library (ng-packagr), standalone components, signal inputs,
OnPush, secondary entry points for tree shaking. - Docs and examples with Storybook or similar, each component showing states and accessibility notes.
- Tests: component tests with harnesses, axe checks, and visual regression tests.
- Semantic versioning and a changelog, with
ng updatestyle migrations when you break things.
- Roll out: start with the highest value components (button, form field, table, dialog) and one pilot app. Provide a migration guide and codemods where possible. Measure adoption.
- Governance: a contribution process, an owner team, a deprecation policy (announce, warn, remove after two releases), and a way for product teams to request components.
Risks: a design system becomes a bottleneck if it is slow to respond, or becomes shelfware if it does not serve real screens. Keep it small, useful and driven by real use.
typescript
import { Component, booleanAttribute, input, output } from '@angular/core';
// Apps use <school-button>, not the library button directly.
// If the library changes, only this wrapper changes.
@Component({
selector: 'school-button',
host: { '[class.school-button--primary]': 'variant() === "primary"' },
template: `
<button type="button" [disabled]="disabled()" (click)="pressed.emit()">
<ng-content />
</button>
`,
styles: [`
button {
background: var(--school-color-action, #1d4ed8);
color: var(--school-color-on-action, #fff);
border: 0;
border-radius: var(--school-radius-md, 6px);
padding: var(--school-space-2, 0.5rem) var(--school-space-4, 1rem);
}
button:disabled { opacity: 0.5; }
`],
})
export class SchoolButtonComponent {
readonly variant = input<'primary' | 'secondary'>('primary');
readonly disabled = input(false, { transform: booleanAttribute });
readonly pressed = output<void>();
}Angular 20.3, type-checked. The sample is a wrapper component with signal inputs that hides the underlying library behind the company API. It was not published as a package here.
Key points
- Compare using a library, a custom system, and a hybrid built on CDK or Material with your own wrapper API.
- Decide on brand fit, accessibility, team capacity and switching cost.
- Build tokens, a versioned library, docs, harness tests, axe checks and visual tests.
- Roll out with a pilot, migration guides, ownership and a deprecation policy.
Common mistakes
- Building a full custom library without a team to maintain it.
- Letting apps import the third party library directly, so a switch is hard.
- Skipping documentation and versioning.
Follow-ups
- How would you handle a breaking change in the library?
- What does wrapping Material components give you?
- How do you measure adoption?
Tips
- Frame it as a decision with criteria.
- Recommend the hybrid and justify it.
- Include governance, not only code.
Evaluation rubric
- Compares the options with criteria.
- Describes how to build and test the system.
- Includes rollout and governance.