data-display/DSTable
DSTable
data-displayGeneric data table with column headers, alternating row tint, hover effect, and row selection support.
iOS 17+macOS 14+
Purpose
Structured data in admin panels, dashboards, and macOS apps.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| columnsreq | [DSTableColumn<T>] | — | Column definitions with title and key path. |
| rowsreq | [T] | — | Array of data items. |
| onSelect | ((T) -> Void)? | nil | Row tap handler. |
Examples
User table
User list with name, email, and role.
swift
DSTable(
columns: [
DSTableColumn(title: "Name", keyPath: \.name),
DSTableColumn(title: "Email", keyPath: \.email),
DSTableColumn(title: "Role", keyPath: \.role),
],
rows: viewModel.users,
onSelect: { user in navigate(.userDetail(user)) }
)