Component architecture is how a user interface is divided into components and how those components share data, state, and behavior. In a design system, it defines what a reusable component owns, what its consumers can configure, and how it fits into a larger interaction.
What belongs in a component’s public API?
The public API is the set of inputs, events, and composition points consumers can rely on. For a dialog, it might include a title, content slots, an open state, and a callback for requests to open or close. Document what each option does and the behavior consumers can expect.
Decide where state lives. An uncontrolled dialog manages whether it is open internally. In a controlled dialog, the application supplies the current state and handles requests to change it. Use controlled state when the workflow needs to coordinate opening or closing. For example, the application can close the dialog after a save succeeds.
Example of a shared dialog
Suppose checkout and account settings both open a modal to review a change.
| Responsibility | Where it belongs |
|---|---|
| Dialog behavior | The shared dialog handles modal focus, keyboard dismissal, and how its title is exposed to assistive technology. |
| Review content | Each product supplies the text, details, and actions for its task. |
| Business outcome | Checkout submits the booking change, shows any error, and closes the dialog after a successful save. |
This boundary lets a product change its workflow without creating a new modal implementation. Review both the isolated component and a real screen. For example, after the dialog closes, check that focus returns to the trigger or another logical element if the trigger is gone.
When should you add a variant or a separate component?
Add an option when consumers need a supported variation of the same interaction, such as a wider surface for comparison content. Compose the dialog with other components when the layout changes. Give a recurring workflow its own pattern or wrapper when it adds business rules that the base dialog cannot own. Before adding a shared option, try it in the screens that need it. Document the default and what each consumer can configure.