Controls Gallery — Layout & Containers Page Spec
Inherits the shell, palette, pointer contract, keyboard contract, and
determinism rules from 00-controls-gallery-overview.md.
Goal
Demonstrate every layout and container control composing child content, including a pointer-draggable split divider and pointer-driven scroll, so the structural behavior of each container is directly observable.
Controls Demonstrated
Control |
Module |
Required |
Events |
Demonstrates |
|---|---|---|---|---|
stack |
Stack |
|
— |
Vertical/horizontal ordered composition |
grid |
Grid |
|
— |
Row/column structured composition |
dock |
Dock |
|
— |
Edge-docked regions + fill |
wrap |
Wrap |
|
— |
Reflowing wrap layout |
border |
Border |
|
— |
Single child with border + padding |
panel |
Panel |
|
— |
General child surface |
scroll-viewer |
Collections |
|
|
Scrollable viewport |
split-view |
Collections |
|
|
Resizable two-region layout |
User Experience
The page is a tour of layout primitives, each rendered with labeled, tinted child boxes so the container's arrangement is unmistakable. The user drags the split view's divider to repartition two regions and wheel-scrolls an overflowing scroll-viewer. The wrap container visibly reflows as the window width changes.
Layout
- A heading
Layout & Containersand description. -
A labeled demo card per container, each holding 3–6 numbered child tiles in
distinct categorical palette tints:
Stackshown both vertical and horizontal with visible spacing.Gridshown as a 3×3 arrangement of tiles.Dockshown with top/left/right/bottom regions around a fill region.Wrapshown with enough tiles to reflow across rows.Bordershown wrapping a single tile with visible border and padding.Panelshown as a plain surface holding tiles.ScrollViewershown with content taller than its viewport.SplitViewshown with two labeled regions and a draggable divider.
Mouse & Pointer Interactions
-
DragBegin/DragMove/DragEndon the split-view divider repartition the two regions continuously, honoring the 4.0 px threshold;onChangedreports the new ratio. -
Wheel
Scrollover the scroll-viewer moves its content and firesonChangedwith the new offset; the scroll thumb is also draggable. -
HoverEnteron a child tile highlights it and narrates its container and index to the status strip. - Resizing the window reflows the
Wrapand re-measures every container live.
Keyboard
Tabmoves focus across focusable demo regions.-
Arrowkeys nudge the split divider and scroll the viewport by a step when those regions are focused.
Core Behaviors
- Stack preserves child order and applies its orientation and spacing.
- Grid places children into rows and columns with aligned cells.
- Dock pins edge regions and gives remaining space to the fill region.
- Wrap flows children left-to-right and wraps to a new row when width is exceeded.
- Border applies a uniform border and padding around exactly one child.
- ScrollViewer clips overflow and exposes a scroll offset via
onChanged. -
SplitView keeps both regions visible, clamps the divider to a min size per side,
and reports the split ratio via
onChanged.
Data Model
- Per-container child tile lists (id, index, tint).
- Split-view ratio and divider drag state.
- Scroll-viewer content size and current offset.
- Window size used for wrap reflow.
Visual / Palette Requirements
- Child tiles use the categorical series palette tints with foreground-legible labels.
- Container chrome (borders, dividers, padding) uses border-divider; the split divider highlights to accent on hover/drag.
- Spacing, padding, and docked widths are visibly non-zero and stable.
App State
Track: per-container child lists; split ratio and drag flag; scroll offset; window size; hovered tile id.
Determinism and Evidence
- Child tile contents are fixed (seed-independent).
- Evidence mode drags the split divider to a set ratio, scrolls the scroll-viewer by a page, and reflows the wrap at two window widths.
- Evidence outcome: final split ratio, final scroll offset, wrap row counts at each width, drag/scroll counts, and close reason.
- Screenshot evidence shows the dock layout, the wrap reflowed across rows, and the split view at a non-default ratio.
Acceptance Criteria
- Each container arranges its children per its documented rule.
-
Dragging the split divider repartitions both regions and fires
onChanged, clamped to per-side minimums. -
Scrolling the viewport moves content and fires
onChanged; the thumb is draggable. - The wrap reflows when the window width changes.
- Border padding and stack spacing are visibly applied and stable.
Out of Scope
- Nested split views or more than two split regions.
- Drag-and-drop of tiles between containers.
- Absolute / canvas positioning beyond the listed containers.