Overview
Blinkit's internal tools often require displaying tabular data in an interactive way, similar to a spreadsheet. This problem simulates a core component of such a tool: a simple grid where users can select cells, observe their coordinates, and visualize the active selection. This exercise tests fundamental UI rendering and state management skills crucial for building interactive dashboards and data entry forms.
What you need to do / Task
Your task is to build a simple interactive grid component with the following features:
- Grid Rendering: Render a fixed grid of 5 rows and 5 columns.
- Cell Content: Each cell in the grid must display its row and column index (e.g., "R0C0", "R0C1", "R1C0", etc.).
- Cell Selection: When a cell is clicked, it should become the "selected" cell.
- Single Selection: Only one cell should be selected at any given time. Clicking a new cell should deselect the previously selected one.
- Visual Feedback: The currently selected cell must have a distinct visual appearance (e.g., a thicker, colored border, or different background).
- Coordinate Display: Above the grid, prominently display the coordinates of the currently selected cell (e.g., "Selected Cell: R2C3"). If no cell is selected (initial state), display "Selected Cell: None".
UI/UX expectations
- The grid should be clearly structured and easy to visually parse.
- Cells should be clearly distinguishable from each other.
- The visual feedback for a selected cell should be immediate and obvious.
- The displayed coordinates should update in real-time with cell selection.
- Basic styling is expected to make the UI presentable.
Acceptance criteria
- A 5x5 grid of interactive cells is rendered on the screen.
- Each cell correctly displays its
R{row_index}C{column_index} identifier.
- Clicking any cell highlights it visually as the active selection.
- Clicking a different cell deselects the previously active cell and highlights the newly clicked one.
- The text label above the grid accurately reflects the coordinates of the currently selected cell.
- When the application initially loads, no cell is selected, and the label displays "Selected Cell: None".