PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Amazon

Design a reusable web dialog component

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design reusable web UI components, covering component API design, state and event management, accessibility considerations, theming, and responsive behavior, and it falls under the Software Engineering Fundamentals domain within front-end engineering.

  • medium
  • Amazon
  • Software Engineering Fundamentals
  • Software Engineer

Design a reusable web dialog component

Company: Amazon

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

You are building a UI component library for a web application and are asked to design and implement a reusable dialog (modal) component. **Requirements** The dialog component should: - Render on top of the page with a semi-transparent **background overlay** whose color can be configured. - Display a **title/header** text. - Include a **close ("X") button** in the header to dismiss the dialog. - Display **arbitrary body content** provided by the parent (e.g., form fields, text, custom elements). - Support one or more configurable **action buttons** (e.g., `OK`, `Cancel`, `Delete`), where the parent can specify: - Button label - Visual style (primary/secondary, etc.) - Click handler - Allow the **parent component to control whether the dialog is open or closed** (i.e., controllable visibility). - Be **reusable** across different parts of the app and easy to style/extend. - Behave well on different screen sizes (desktop and mobile). - Handle basic **accessibility** concerns (e.g., keyboard navigation, screen readers). **Task** Describe how you would design this component, including: 1. **Public API** - What inputs/props it exposes (e.g., `isOpen`, `onClose`, `title`, `actions`, `backdropColor`, etc.). - What events/callbacks it emits to the parent. 2. **Internal behavior and state management** - Which aspects of state are controlled by the parent vs. internal to the dialog (e.g., visibility, focus management). - How clicks on the overlay, close button, or action buttons are handled. 3. **Implementation outline in a modern front-end stack** (e.g., React, Vue, or vanilla JS): - How the DOM structure is organized (overlay, dialog container, header, body, footer). - How you handle **keyboard interaction** (e.g., `Esc` to close, `Tab` focus trapping). - How you handle **accessibility** (ARIA roles/attributes such as `role="dialog"`, `aria-modal`, labeling, initial focus). - How you support configurable background overlay color and theming. You do *not* need to write full production-ready code, but your answer should be concrete enough that another engineer could implement the component from your design.

Quick Answer: This question evaluates a candidate's ability to design reusable web UI components, covering component API design, state and event management, accessibility considerations, theming, and responsive behavior, and it falls under the Software Engineering Fundamentals domain within front-end engineering.

Related Interview Questions

  • Debug Watch List Movie Operations - Amazon (medium)
  • Design an advertiser metrics tracking platform - Amazon (medium)
  • Implement Review Content Moderation - Amazon (medium)
  • Validate AI-Generated Code Safely - Amazon (medium)
  • Fix the Password Reset Workflow - Amazon (medium)
Amazon logo
Amazon
Oct 31, 2025, 12:00 AM
Software Engineer
Onsite
Software Engineering Fundamentals
1
0

You are building a UI component library for a web application and are asked to design and implement a reusable dialog (modal) component.

Requirements

The dialog component should:

  • Render on top of the page with a semi-transparent background overlay whose color can be configured.
  • Display a title/header text.
  • Include a close ("X") button in the header to dismiss the dialog.
  • Display arbitrary body content provided by the parent (e.g., form fields, text, custom elements).
  • Support one or more configurable action buttons (e.g., OK , Cancel , Delete ), where the parent can specify:
    • Button label
    • Visual style (primary/secondary, etc.)
    • Click handler
  • Allow the parent component to control whether the dialog is open or closed (i.e., controllable visibility).
  • Be reusable across different parts of the app and easy to style/extend.
  • Behave well on different screen sizes (desktop and mobile).
  • Handle basic accessibility concerns (e.g., keyboard navigation, screen readers).

Task

Describe how you would design this component, including:

  1. Public API
    • What inputs/props it exposes (e.g., isOpen , onClose , title , actions , backdropColor , etc.).
    • What events/callbacks it emits to the parent.
  2. Internal behavior and state management
    • Which aspects of state are controlled by the parent vs. internal to the dialog (e.g., visibility, focus management).
    • How clicks on the overlay, close button, or action buttons are handled.
  3. Implementation outline in a modern front-end stack (e.g., React, Vue, or vanilla JS):
    • How the DOM structure is organized (overlay, dialog container, header, body, footer).
    • How you handle keyboard interaction (e.g., Esc to close, Tab focus trapping).
    • How you handle accessibility (ARIA roles/attributes such as role="dialog" , aria-modal , labeling, initial focus).
    • How you support configurable background overlay color and theming.

You do not need to write full production-ready code, but your answer should be concrete enough that another engineer could implement the component from your design.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.