# LayoutContainer-Ex: Rows with Adjustable Columns ## Investigation Summary The goal is to support a **row-based layout** where each row can have independently adjustable column widths (e.g. 30/70, 50/50, 33/33/34). This document analyses the current architecture, identifies every surface that would need changes, and assesses a "build new + keep old" strategy. --- ## Current Architecture ### Data Model (`LayoutManager.ts`) ```typescript interface LayoutContainer { id: string; type: 'container'; columns: number; // ← single integer, drives CSS grid-cols-N gap: number; // ← pixel gap between cells widgets: WidgetInstance[]; children: LayoutContainer[]; order?: number; settings?: { collapsible?: boolean; collapsed?: boolean; title?: string; showTitle?: boolean; customClassName?: string; enabled?: boolean; }; } ``` **Key observations:** | Aspect | Current behaviour | |--------|-------------------| | **Column model** | `columns: number` — equal-width columns only (1–12). Rendered via Tailwind `grid-cols-N` classes. | | **Widget placement** | Widgets have an `order` index. The CSS grid auto-flows them left-to-right, top-to-bottom. There is no "widget belongs to column X" field. | | **Column targeting** | `addWidgetToContainer()` accepts `targetColumn?: number` but only uses it to calculate an insertion _index_ — it is a positional hint derived from `index % columns`, not a persistent assignment. | | **Row concept** | None. Rows are an implicit side-effect of CSS grid wrapping. | | **Nesting** | Containers can nest up to 3 levels deep. Nested containers span `col-span-full`. | | **Container children** | `children: LayoutContainer[]` — nested containers always appear _after_ all widgets. | ### Rendering (`LayoutContainer.tsx`) The component builds grid classes via `getGridClasses(columns)` → `grid-cols-1 md:grid-cols-N`. All widgets and children are rendered inside one `