Frontend School

Dynamic Dashboard with Configurable Tabs and Widgets

Machine Coding
hard

Dynamic Dashboard with Configurable Tabs and Widgets

Hard
React
TypeScript
UI Components
State Management
Dynamic Content

Overview

At Razorpay, our internal dashboards are critical for monitoring various financial metrics and operational data. This problem challenges you to build a simplified, yet robust, dynamic dashboard where users can switch between different 'views' using tabs. Each tab will then dynamically render a curated set of 'widgets' based on a provided configuration. This approach ensures flexibility and a tailored user experience for accessing complex data.

What you need to do / Task

Your primary goal is to implement a React application that displays a dynamic dashboard based on a given configuration object. Specifically, you need to:

  1. Implement Tab Navigation: Create a set of interactive tabs at the top of the dashboard.
  2. Manage Active Tab State: When a tab is clicked, it should become the active tab.
  3. Dynamic Content Rendering: Below the tabs, render the specific set of widgets associated with the currently active tab.
  4. Widget Interpretation: Each widget should be rendered dynamically based on its type property defined in the configuration. You will handle two types of widgets: TextWidget and ChartWidget.

UI/UX expectations

  • Tab Layout: Tabs should be displayed horizontally. The active tab should be visually distinct (e.g., highlighted, bolded, or have an indicator).
  • Content Area: The area below the tabs should update immediately to display the widgets of the selected tab.
  • Widget Display: Widgets within a tab should be rendered cleanly, each with its title clearly visible. Arrange them in a responsive grid or vertical stack.
  • Basic Styling: Apply minimal styling to ensure readability and a clean layout, making tabs and widgets distinguishable.

Acceptance criteria

  • Clicking on any tab successfully changes the active tab's visual state.
  • Upon clicking a tab, the content area below the tabs dynamically updates to display only the widgets configured for that specific tab.
  • Each TextWidget correctly renders its title and content.
  • Each ChartWidget correctly renders its title and a placeholder indicating its chartType and data (no actual charting library integration is required).
  • The dashboard loads initially with the first tab selected and its corresponding widgets displayed.
  • The application should run without any console errors or warnings.

Constraints

Constraints & assumptions

  • The dashboard configuration, including tabs and their respective widgets, will be provided as a static TypeScript object (mock data) within App.tsx.
  • You are required to use modern React (functional components with Hooks) and TypeScript.
  • The focus is on front-end logic and component rendering; no backend integration or API calls are necessary.
  • For ChartWidget, you only need to render a visual placeholder for the chart, not an actual interactive chart.
  • Browser environment with typical modern browser features.

Out of scope

  • Backend integration or API calls.
  • Complex routing for tabs (e.g., URL parameters).
  • Advanced accessibility features beyond basic semantic HTML elements.
  • Full-fledged charting library integration (e.g., Chart.js, D3.js).
  • Error handling for malformed widget configurations.

What interviewers evaluate

  • Correct and robust implementation of dynamic tab switching and content rendering.
  • Modular and reusable component design (e.g., separate components for tabs, tab content, and individual widgets).
  • Effective use of React state and props for managing UI interactions and data flow.
  • Clean, readable, and maintainable TypeScript code with appropriate type definitions.

Loading editor...