SwipeUI

Table card

Label and value rows with wrapping text, hairline separators and optional row actions.

npx @swipeui/cli add table-card
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • A short summary of settings or plan limits.
  • Comparing labels and values in a tidy surface.
  • A read-only breakdown of session details.
  • Independent actions for a small set of facts.

When not to use it

  • Editable data grids: use a dedicated table editor.
  • One large number: use metric-card.
  • A navigation topic with description: use info-card.
  • Long lists: use list-row.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add table-card
  • Adds components/swipeui/card/table-card.tsx and 6 shared helpers.
  • Installs class-variance-authority, react-native-reanimated, react-native-worklets, uniwind, clsx, tailwind-merge, expo-haptics. In Expo apps it uses npx expo install so versions match your SDK.

Usage

plan-summary.tsx
import { TableCard } from '@/components/swipeui/card/table-card';

<TableCard rows={[{ label: 'Study', value: '25 min per session' }, { label: 'Break', value: '5 min' }]} />;

Examples

compact-summary.tsx
import { TableCard } from '@/components/swipeui/card/table-card';

<TableCard title="Session limits" density="compact" surface="filled" separators={false}
  rows={[{ label: 'Sessions', value: '4' }, { label: 'Max Members', value: '5' }]} />;

Glass appearance

In the preview, choose Glass in the Preset picker. Pass the Pro Glass material into surfaceBackground to style the card fill.

API reference

PropTypeDefaultDescription
rowsreadonly TableCardRow[]—

Ordered label and value pairs.

title?stringundefined

Optional heading above the rows.

separators?booleantrue

Hairlines between rows, never after the last.

surface?"filled" | "outline" | "raised"'outline'

Surface treatment.

surfaceBackground?objectundefined

Decorative replacement for the card fill. It receives the card’s bounds.

density?"comfortable" | "compact"'comfortable'

Comfortable rows start at 56pt; compact at 44pt. Both grow with text.

onRowPress?((index: number) => void)undefined

Makes each row a button, reporting its current index.

disabled?booleanfalse

Prevent all row actions.

haptics?booleantrue

Row activation feedback.

motion?MotionOverridethe app's feel

Row press character.

className?stringundefined

Classes merged over the root surface.

style?StyleProp<ViewStyle>undefined

Native root style.

testID?stringundefined

Root identifier; rows append -row-N, separators -separator-N.

Composition and behavior

  • The title is an optional heading; each label/value pair is one screen-reader stop.
  • Values wrap and align to the reading end. Labels reserve 40% of the width. Both densities grow with Dynamic Type.
  • Give changing rows stable ids. Custom value nodes need a row accessibilityLabel.
  • With onRowPress, rows become independent buttons. Keep interactive children outside those rows.

Table settings

PropDoesDefault
rowsOrdered label, value, optional id and spoken labelRequired
titleHeading above the factsNone
separatorsHairlines between rowstrue
surfaceraised, outline or filledoutline
densitycomfortable or compactcomfortable
onRowPressActivates a row by current indexNone
disabledBlocks row actionsfalse
hapticsImpact on activationtrue
motionShared row press characterApp feel
className / styleRoot stylingNone
testIDRoot and part identifiersNone

Behavior and gestures

  • Use surfaceBackground for a material behind the entire table.
  • Rows are static unless onRowPress receives their index.
  • separators toggles hairlines; surface and density tune presentation independently.
  • disabled prevents all row actions; haptics switches press feedback independently.
  • motion overrides the press feel; static rows do not animate.

Accessibility

  • Each row is one labelled text element or button; the title is a header.
  • Custom value nodes need row.accessibilityLabel to describe their meaning.
  • 44pt compact and 56pt comfortable minimum rows grow with Dynamic Type.
  • RTL reverses reading order and end alignment. Reduce Motion stops press scaling.

Motion

  • Uses the press motion role, so it follows your app's feel. Pass motion to tune this one instance.
  • Interactive rows use the shared press role; static rows stay still.
  • Reduce Motion removes press scaling.

Performance

  • No state, timers or measurements; give changing rows stable ids.

Notes for AI

  • Pass rows in reading order. Use a spoken accessibilityLabel for custom value nodes.
  • Leave onRowPress undefined for facts. Demo controls belong outside the surface.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items