System Designhard

Design reusable components and a frontend component library

Design a reusable component system for a large SaaS product. Cover API design, composition, theming, accessibility, testing, versioning, documentation, and avoiding over-abstraction.

Asked at Tenable

#component library#design system#architecture#accessibility

Answer

Interview framing: A component library should make product teams faster while keeping UX consistent. The hard part is designing APIs that are flexible without becoming vague.

Design principles:

  1. Start from real product use cases:
  • Extract components after repeated patterns appear.
  • Avoid abstracting one-off UI too early.
  1. Separate primitives and product components:
  • Primitives: Button, Input, Modal, Tooltip, Table.
  • Product components: VulnerabilityCard, RiskBadge, AssetSelector.
  1. Component APIs:
  • Prefer composition for complex components.
  • Keep props predictable and typed.
  • Avoid boolean prop explosions like primary + danger + outlined + compact.
  1. Accessibility:
  • Keyboard behavior, focus management, ARIA, labels, and screen reader behavior are part of the component contract.
  1. Theming:
  • Use design tokens for color, spacing, typography, radius, shadows.
  • Support dark mode/high contrast if required.
  1. Testing and documentation:
  • Unit/component tests for behavior.
  • Visual regression for design-sensitive components.
  • Storybook or equivalent docs with examples and edge cases.
  1. Versioning:
  • Communicate breaking changes.
  • Provide migration notes or codemods for large changes.

Pitfalls:

  • Too much configurability makes components hard to reason about.
  • Too little flexibility causes teams to fork or bypass the library.
  • Accessibility cannot be patched at the end.

Source: Tenable frontend job description

Practise more System Design questions →