Responsive layout guide for IDE.AI with breakpoints, CSS grid configuration, and terminal size handling
| Width | Breakpoint | Columns | Per-Col Width | Terminal Example |
|---|---|---|---|---|
| < 80 | Small | 1 | ~79 | 60x20 (mobile) |
| 80-159 | Medium | 2 | ~39 | 120x30 (laptop) |
| 160-239 | Large | 3 | ~52 | 160x40 (wide) |
| ≥ 240 | XL | 4 | ~59 | 240x50 (ultrawide) |
# In panel_grid.py
_COLS_THRESHOLDS = [(240, 4), (160, 3), (80, 2), (0, 1)]
def _cols_for_width(width: int) -> int:
for threshold, cols in _COLS_THRESHOLDS:
if width >= threshold:
return cols
return 1
# In PanelGrid.on_resize()
def on_resize(self, event: Resize) -> None:
self.styles.grid_size_columns = _cols_for_width(event.size.width)
PanelGrid {
layout: grid;
grid-size: 1; /* Base, overridden by on_resize() */
grid-gutter: 1 1; /* 1 char vertical & horizontal */
height: 1fr; /* Fill available height */
padding: 0 1; /* 1 char left/right, 0 top/bottom */
}
┌──────────────────────────────┐
│ Claude Chat │
│ You: hello │
│ Claude: Hi there! │
│ > type here... │
└──────────────────────────────┘
Width per column: ~79 chars (79 - 0 padding - 0 gutter) Use case: Mobile terminals, SSH sessions, narrow windows
┌──────────────────┬──────────────────┐
│ Chat 1 │ Chat 2 │
│ You: hello │ You: help │
│ Claude: Hi! │ Copilot: Sure! │
│ > _ │ > _ │
└──────────────────┴──────────────────┘
Width per column: ~39 chars
Calculation: (80 - 2 padding) - 1 gutter = 77 ÷ 2 = ~38-39 chars
Use case: Standard laptop terminals, most development environments
┌─────────────┬─────────────┬─────────────┐
│ Claude [1] │ Claude [2] │ Copilot [3] │
│ You: X │ You: Y │ You: Z │
│ > _ │ > _ │ > _ │
└─────────────┴─────────────┴─────────────┘
Width per column: ~52 chars
Calculation: (160 - 2 padding) - 2 gutters = 156 ÷ 3 = ~52 chars
Use case: Wide monitors, split screen workflows
┌─────────┬─────────┬─────────┬─────────┐
│ C1 │ C2 │ C3 │ C4 │
│ > _ │ > _ │ > _ │ > _ │
└─────────┴─────────┴─────────┴─────────┘
Width per column: ~59 chars
Calculation: (240 - 2 padding) - 3 gutters = 235 ÷ 4 = ~58-59 chars
Use case: Ultra-wide monitors, productivity setups
For each breakpoint, we verify minimum readability:
# Layout integrity calculation
available_width = terminal_width - padding_left_right # e.g., 80 - 2 = 78
col_width = (available_width - (cols - 1) * gutter) // cols
# Example: 80x24 terminal
# → 2 columns
# → (78 - 1*1) / 2 = 38-39 chars per column
Minimum column width targets:
# All responsive tests
pytest tests/test_responsive_layout.py -v
# Specific breakpoint
pytest tests/test_responsive_layout.py::TestResponsiveBreakpoints -v
# Real-world scenarios
pytest tests/test_responsive_layout.py::TestRealWorldTerminalSizes -v
IDE.AI listens to terminal resize events and recalculates layout in real-time:
def on_resize(self, event: Resize) -> None:
"""Handle terminal resize."""
new_cols = _cols_for_width(event.size.width)
if new_cols != self.styles.grid_size_columns:
self.styles.grid_size_columns = new_cols
# Panels automatically reflow
Transition behavior:
/* Hide non-essential UI on small screens */
@media (max-width: 79) {
#session-info {
display: none;
}
ActionBar {
display: none;
}
}
/* Adjust spacing for large screens */
@media (min-width: 240) {
ChatPanel > #chat-log {
padding: 2 3; /* More generous padding */
}
}
Always test across all breakpoints
Use percentage-based sizing
1fr in grid layoutsProvide fallback behaviors
Monitor terminal resize events
Test with real terminals
Current Status: Stable — Phase 2 Responsive
Test Results: 50/50 passing ✓
Last Updated: 2024
Maintainer: GitHub Copilot CLI