Controls Gallery — Data & Collections Page Spec
Inherits the shell, palette, pointer contract, keyboard contract, and
determinism rules from 00-controls-gallery-overview.md.
Goal
Demonstrate the bounded-range data controls — a virtualized list view, a hierarchical tree, and a sortable, selectable data grid — driven by pointer selection, header-click sorting, expand/collapse, and wheel scrolling over large datasets.
Controls Demonstrated
Control |
Module |
Required |
Events |
Demonstrates |
|---|---|---|---|---|
list-view |
Collections |
|
|
Bounded visible-range virtual list |
tree-view |
Collections |
|
|
Hierarchical expand/collapse |
data-grid |
DataGrid |
|
|
Rows, columns, sort, focus, selection |
User Experience
The page splits into three panes. A large ListView scrolls smoothly over
thousands of generated items rendering only its visible range. A TreeView shows a
nested structure the user expands and collapses by clicking disclosure triangles. A
DataGrid of ~1000 rows supports clicking a header to sort, clicking a row to
select, moving the focused cell, and wheel-scrolling — all without resizing.
Layout
- A heading
Data & Collectionsand description. -
A
SplitViewwith theListViewandTreeViewstacked on the left and theDataGridfilling the right. - The data grid has typed columns (e.g. Id: int, Name: text, Status: badge, Value: number) with a header row and a fixed visible window over the row set.
- A status line under the grid shows total rows, the visible range, the selected row, the focused cell, and the active sort.
Mouse & Pointer Interactions
-
Wheel
Scrollover the list, tree, or grid advances the visible range; only the visible window renders. Clicka list row firesonSelectedand highlights it.-
Clicka tree disclosure triangle expands/collapses that node;Clicka node label selects it. -
Clicka grid header firesonSortChanged, cycling ascending → descending → none, and re-orders rows. -
Clicka grid row firesonSelected; clicking a cell firesonFocusChangedand moves the focused-cell outline. -
HoverEnteron a row/cell raises the hover highlight; the status strip narrates the pointer kind, target, and coordinates.
Keyboard
-
Arrow Up/Downmove the selection/focus within the focused collection;PageUp/PageDownmove by a visible page. Arrow Left/Rightcollapse/expand the focused tree node.Enteractivates the focused row;Home/Endjump to first/last.
Core Behaviors
- Each collection renders only its bounded visible range and recycles rows on scroll; selection and focus survive scrolling out of and back into view.
- The tree maintains per-node expanded state; collapsing a node hides its subtree but preserves its descendants' selection state.
- The grid sorts stably by the clicked column, preserves the selected row identity across a sort, and keeps the focused cell within bounds.
- Headers, the grid's column row, and the status line keep fixed dimensions while rows scroll.
Data Model
- ListView: a large generated item sequence and the selected index/key.
- TreeView: a nested node structure with per-node expanded flags and selection.
- DataGrid: a column schema (name + type), a row set, the visible range, the selected row key, the focused cell (row, column), and the active sort (column + direction).
Visual / Palette Requirements
- Selected rows use accent-soft fill with accent text; the focused grid cell shows the focus ring; hovered rows use surface-raised.
- The grid's
Statuscolumn renders badges in the success/warning/danger roles. - Sort direction shows an accent indicator in the active header.
App State
Track: list items and selection; tree structure, expanded set, and selection; grid columns, rows, visible range, selection, focused cell, and sort; hovered ids; scroll offsets; seed.
Determinism and Evidence
- Accept a seed governing generated list items and grid rows; the same seed yields identical data.
- Evidence mode scrolls the list by a page, expands then collapses a tree node, clicks a grid header to sort, selects a row, and moves the focused cell.
- Evidence outcome: total rows, final visible range, selected keys, focused cell, active sort, scroll deltas, and close reason.
- Screenshot evidence shows the list mid-scroll, an expanded tree node, and the grid sorted by a column with a selected row and focused cell.
Acceptance Criteria
- Each collection renders only its visible range and scrolls by wheel and keyboard.
- List, tree, and grid selection fire their events and survive scrolling.
- Tree nodes expand/collapse by pointer and keyboard, preserving subtree state.
- Grid header clicks cycle and apply a stable sort, preserving selected-row identity.
- The focused cell moves by click and arrows and stays in bounds.
- Headers and the status line stay fixed while rows scroll.
Out of Scope
- Inline cell editing in the data grid.
- Column reordering or resizing by drag.
- Grouping, pivoting, or aggregation rows.