Skip to content
tezvyn:

Designing Durable Component APIs

Source: supernova.ioHardHow cards are made

Designing Durable Component APIs

The best component API is often no API. Design from the user's perspective by first writing the ideal usage snippet, a "dream-driven" approach. This ensures intuitive components that boost design system adoption.

Why it exists

Design systems fail when developers don't adopt them. A primary driver of adoption is a superior developer experience, and the component API is the main entry point. Poorly designed, inconsistent properties create friction and discourage use, while predictable, intuitive APIs make the system a pleasure to work with.

The mental model

Embrace "dream-driven development." The best API is no API. Before writing any implementation code, put yourself in the user's shoes and write the code snippet showing how you WISH the component could be used. Start with this ideal state, free from technical constraints, to anchor your design around the best possible developer experience.

How it works

First, define the ideal API by writing a usage example. For instance, an animation library might have a single "magic" property that handles transitions automatically. This sets a high bar for user experience. Second, after defining this ideal, you gradually reintroduce necessary complexity, making deliberate trade-offs instead of letting limitations dictate the design from the start. For system health, every change must be systematic. When adding a property, review other components to ensure consistent naming. For example, if you use variant to control style variations on a Button, don't use type or mode on a Card. This consistency is what makes it a system.

When to use it

This approach is critical when building or refactoring any component in a shared design system. It's most important for foundational components like Buttons, Inputs, and Modals, as they set the pattern for all future components and have the widest impact on developers.

When not to use it

While the principle of consistency is always valuable, the full "dream-driven" process might be overkill for one-off, internal-only components not intended for wide consumption. In such cases, you might prioritize implementation speed, but you should still avoid introducing names or patterns that conflict with the established system.

One canonical example

Imagine your Button component has variant="solid" and variant="outline". You need to add a red "danger" version. Do you add a new variant, like variant="danger-solid"? Or do you add a new property, like color="danger", that combines with the existing variants? A systematic approach forces you to decide which pattern scales better. If other components will also need color variations, establishing a separate color property creates a more robust and predictable system than creating dozens of combinatorial variant names.

Interview question

What is the primary objective of employing the 'dream-driven development' approach for component API design?

  • a.To reduce the total number of properties a component exposes, aiming for a minimal API surface.
  • b.To ensure all component properties adhere to a predefined, systematic naming convention from the start.
  • c.To accelerate component implementation by deferring complex technical constraints until later stages.
  • d.To prioritize developer experience and intuitive usage by envisioning the ideal interaction.Correct
Why?

The card states that 'dream-driven development' involves writing the ideal usage snippet 'to anchor your design around the best possible developer experience.' This approach prioritizes intuition and user experience. While it might lead to simpler APIs, its primary goal isn't merely to minimize properties (Option A), but to design for optimal usability and adoption.

Just read this? Test yourself on what you have been reading.

Read the original → supernova.io

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on design systems — each one lists the topics its interview covers.

See open roles