Element: #491 Dense, pinned and grouped (display/table) What it shows: A dense SimpleTable of leads inside an already framed, horizontally scrolling panel: compact rows, two pinned columns, collapsible stage groups, a sortable Name header and clickable rows. When to use: CRM or spreadsheet-like record lists that need many columns and rows: dense rows, pinned checkbox and name columns, grouped sections and keyboard-operable rows. Spec: - `` inside a caller-owned `overflow-x: auto` panel - `` renders a sentence-case sortable header whose `sort` is `none`, `asc` or `desc` - One `` per stage with `` as its first row - ` import { SimpleTable, TableRow, TableGroupRow, TableSortHeader, Checkbox } from '@codeatlasdev/ui'; type Lead = { id: string; name: string; company: string; owner: string; value: number; stage: string }; const leads: Lead[] = [ { id: 'l1', name: 'Ana Souza', company: 'Atlas Co', owner: 'Matheus', value: 12000, stage: 'New' }, { id: 'l2', name: 'Bruno Lima', company: 'Nimbus', owner: 'Carla', value: 8400, stage: 'New' }, { id: 'l3', name: 'Carla Dias', company: 'Orbit', owner: 'Diego', value: 22000, stage: 'Won' }, { id: 'l4', name: 'Diego Reis', company: 'Vertex', owner: 'Matheus', value: 5600, stage: 'Won' }, ]; let sort = $state<'none' | 'asc' | 'desc'>('none'); let selected = $state('l2'); let opened = $state>({ New: true, Won: true }); let last = $state('Nothing opened yet'); const sorted = $derived( sort === 'none' ? leads : [...leads].sort((a, b) => (sort === 'asc' ? 1 : -1) * a.name.localeCompare(b.name)), ); const stages = $derived([...new Set(sorted.map((l) => l.stage))]); const cycle = () => (sort = sort === 'none' ? 'asc' : sort === 'asc' ? 'desc' : 'none');
Name Company Owner Stage Value {#each stages as stage (stage)} {#snippet label()}{stage} {sorted.filter((l) => l.stage === stage).length}{/snippet} {#if opened[stage]} {#each sorted.filter((l) => l.stage === stage) as l (l.id)} { selected = l.id; last = `Opened ${l.name}`; }}> {l.name} {l.company} {l.owner} {l.stage} {l.value.toLocaleString('en-US', { style: 'currency', currency: 'USD' })} {/each} {/if} {/each}

{last}