SweetUI

Search items

Jump to an item

component

table

Identifiable rows in aligned columns; numeric monospaced; optional summary rows.

tablegriddatarowscolumnsshadcn
table, light

On iPad

The same installed source at a regular width. It adapts its layout without a separate design.

table on iPad, light

Install

With the sweetui tool (brew install mangobyte-dev/tap/sweetui):

sweetui install table --destination Sources/YourFeature/Components

Installs in order: separator 0.2.1, table 0.1.1. Point --destination at a folder inside the consuming target's sources.

Usage

DataTable(
    lines,
    columns: [
        DataTableColumn(Text("Item")) { Text($0.item) },
        DataTableColumn(Text("Qty"), alignment: .trailing) { Text($0.quantity, format: .number) },
        DataTableColumn(Text("Amount"), alignment: .trailing) { Text($0.amount, format: .currency(code: "USD")) }
    ],
    footer: [
        DataTableFooterRow(label: Text("Total due"), value: Text(total, format: .currency(code: "USD")), isEmphasized: true)
    ]
)

Accessibility contract

  • Row combines into one element; header row carries trait.
  • Trailing columns hold numbers, hug edge; figures align.
  • Grid, not Table (single column on iPhone); leading column takes remaining width.
  • System text styles, semantic spacing, theme separators; cells wrap not truncate.

Details

Kindcomponent
Version0.1.1
PlatformsiOS 26.0+
Dependenciesseparator
SourceRegistry/sources/components/DataTable.swift
Xcode previewData Table