DataView
Present one immutable collection as a polished list or responsive grid with typed templates, controlled Signals, deterministic local state and remote request ownership.
GET STARTED
Import
Import the canonical component and only the standalone template directives used by the view.
List and grid from one collection
The header composes NeuralSelect and NeuralButton controls. DataView owns presentation, stable sorting and current-page slicing.
Compute
Agent Hub
A command center for autonomous workflows.
Office
Context Board
Keep intent visible to every collaborator.
Accessories
Headless Clock
Timezone-safe focus for distributed agents.
Lighting
Hydration Lamp
Adaptive light with instant startup.
Audio
Neural Speaker
Clear spatial sound for focused teams.
Office
Signal Desk
A calm workspace for reactive products.
Deterministic local state
Local mode clones before sorting, supports nested paths such as metadata.category, preserves equal-value order and clamps paging without mutating source data.
layout, first, rows and sort state remain writable Signals.
Equal values retain their source order.
Every semantic event carries the complete state snapshot.
Remote request ownership
Remote mode renders the page exactly as supplied and emits state for the application to fetch. It never sorts or slices server data.
Loading and empty states
Busy content is replaced by stable skeletons or a typed loading template. Empty content can be fully owned without losing its label context.
Six typed template surfaces
List and grid contexts infer T from their bound collection. State templates receive the configured label; header and footer remain ordinary composition surfaces.
Identity and custom sorting
trackBy keeps DOM identity stable. sortComparator replaces value comparison while DataView still owns stable tie-breaking and sort direction.
Unstyled and typed class slots
Headless mode removes every NeuralNg visual class while semantic structure, state, typed contexts and Paginator behavior remain.
Responsibility boundaries
Presentation, layout, paging, sorting, templates, loading/empty state and accessible collection structure.
Fetching, filtering, selection, editing and business actions. Use VirtualScroller for windowing.
ACCESSIBILITY
Semantic collection presentation
DataView provides structure and state announcements while interaction remains owned by the controls composed around or inside each item.
Region naming
The root exposes role="region". Set a concise ariaLabel that distinguishes the collection from other regions.
Collection semantics
Both visual layouts retain role="list" and native article items with role="listitem". Grid is visual, not an interactive ARIA grid.
Loading and empty state
aria-busy appears only while loading. The fallback loading label is exposed through a status region while skeleton geometry stays hidden from assistive technology.
Interactive controls
Layout, sort and item actions must be real controls with names and state such as aria-pressed. DataView does not make an entire item clickable implicitly.
Reduced motion
Skeleton animation and item hover movement stop under prefers-reduced-motion: reduce.
PUBLIC CONTRACT
DataView API
Inputs and controlled models
| Name | Type | Default | Purpose |
|---|---|---|---|
| value | readonly T[] | [] | Immutable source or current remote page. |
| layout | 'list' | 'grid' | 'list' | Controlled visual layout model. |
| first | number | 0 | Controlled first record offset model. |
| rows | number | 6 | Controlled page-size model; normalized to at least one. |
| sortField | string | '' | Controlled property path model; nested paths work. |
| sortOrder | 1 | -1 | 1 | Controlled ascending or descending model. |
| dataMode | 'local' | 'remote' | 'local' | Ownership of sorting and paging. |
| totalRecords | number | 0 | Full remote result count. |
| paginator | boolean | true | Composes Neural Paginator. |
| pageSizeOptions | readonly number[] | [6, 12, 24] | Paginator sizes. |
| loading | boolean | false | Replaces content and exposes busy state. |
| loadingRows | number | 6 | Fallback skeleton count. |
| emptyMessage | string | 'No records found' | Empty state label/context. |
| loadingMessage | string | 'Loading records' | Accessible loading label/context. |
| ariaLabel | string | 'Data view' | Accessible region name. |
| unstyled | boolean | false | Removes NeuralNg visual classes. |
| dataViewClass | string | '' | Additive root class. |
| classes | NeuralDataViewClasses | {} | Typed additive slot classes. |
| trackBy | NeuralDataViewTrackBy<T> | null | null | Stable item identity. |
| sortComparator | NeuralDataViewSortComparator<T> | null | null | Domain comparator. |
Outputs
| Name | Payload | Meaning |
|---|---|---|
| layoutChange | NeuralDataViewLayout | Generated by layout model. |
| firstChange | number | Generated by first model. |
| rowsChange | number | Generated by rows model. |
| sortFieldChange | string | Generated by sortField model. |
| sortOrderChange | 1 | -1 | Generated by sortOrder model. |
| stateChange | NeuralDataViewStateChange | Unified page/layout/sort event. |
| pageChange | NeuralDataViewPageEvent | Semantic paginator event. |
| layoutChanged | NeuralDataViewLayoutChange | Layout event with previous value. |
| sortChange | NeuralDataViewSortChange | Sort event with previous field/order. |
Template directives
neuralDataViewListItemNeuralDataViewItemTemplateContext<T>
neuralDataViewGridItemNeuralDataViewItemTemplateContext<T>
neuralDataViewHeadervoid
neuralDataViewFootervoid
neuralDataViewEmptyNeuralDataViewStateTemplateContext
neuralDataViewLoadingNeuralDataViewStateTemplateContext
Typed class slots
rootheadercontentlistgriditememptyloadingskeletonpaginatorfooterTypes and helper
NeuralDataViewLayout'list' | 'grid'
NeuralDataViewDataMode'local' | 'remote'
NeuralDataViewSortOrder1 | -1
NeuralDataViewStateSerializable controlled state snapshot.
NeuralDataViewStateChangeState plus reason: 'page' | 'layout' | 'sort'.
NeuralDataViewItemTemplateContext<T>Typed item and positional context.
compareDataViewValuesPublic null-safe default comparison helper.
DESIGN TOKENS
DataView visual contract
Component variables resolve after semantic theme tokens and before additive consumer classes.
Root, header and footer
--neural-data-view-colorComponent foreground color.
--neural-data-view-backgroundComponent background surface.
--neural-data-view-borderComponent border shorthand.
--neural-data-view-radiusComponent corner radius.
--neural-data-view-shadowComponent box shadow.
--neural-data-view-header-paddingHeader internal spacing.
--neural-data-view-header-backgroundHeader background surface.
--neural-data-view-header-borderHeader border shorthand.
--neural-data-view-footer-paddingFooter internal spacing.
--neural-data-view-footer-backgroundFooter background surface.
--neural-data-view-footer-borderFooter border shorthand.
Layout and items
--neural-data-view-content-backgroundContent background surface.
--neural-data-view-grid-minMinimum item width used by the responsive grid layout.
--neural-data-view-grid-gapSpacing between grid items.
--neural-data-view-grid-paddingGrid internal spacing.
--neural-data-view-list-dividerBorder drawn between adjacent items in list layout.
--neural-data-view-list-item-paddingList item internal spacing.
--neural-data-view-item-backgroundItem background surface.
--neural-data-view-item-borderItem border shorthand.
--neural-data-view-item-radiusItem corner radius.
--neural-data-view-item-shadowItem box shadow.
--neural-data-view-item-hover-borderItem hover border shorthand.
--neural-data-view-item-hover-shadowItem hover box shadow.
Loading and empty states
--neural-data-view-empty-min-heightEmpty minimum block size.
--neural-data-view-empty-gapSpacing between empty items.
--neural-data-view-empty-paddingEmpty internal spacing.
--neural-data-view-empty-colorEmpty foreground color.
--neural-data-view-empty-icon-colorEmpty icon foreground color.
--neural-data-view-loading-gapSpacing between loading items.
--neural-data-view-loading-paddingLoading internal spacing.
--neural-data-view-skeleton-min-heightSkeleton minimum block size.
--neural-data-view-skeleton-backgroundSkeleton background surface.
--neural-data-view-skeleton-radiusSkeleton corner radius.
--neural-data-view-skeleton-durationSkeleton animation duration.
Paginator wrapper
--neural-data-view-paginator-paddingPaginator internal spacing.
--neural-data-view-paginator-borderPaginator border shorthand.