Table card
Label and value rows with wrapping text, hairline separators and optional row actions.
npx @swipeui/cli add table-cardWhen 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.tsxand 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 installso versions match your SDK.
Usage
import { TableCard } from '@/components/swipeui/card/table-card';
<TableCard rows={[{ label: 'Study', value: '25 min per session' }, { label: 'Break', value: '5 min' }]} />;Examples
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
| Prop | Type | Default | Description |
|---|---|---|---|
rows | | — | Ordered label and value pairs. |
title? | | | Optional heading above the rows. |
separators? | | | Hairlines between rows, never after the last. |
surface? | | | Surface treatment. |
surfaceBackground? | | | Decorative replacement for the card fill. It receives the card’s bounds. |
density? | | | Comfortable rows start at 56pt; compact at 44pt. Both grow with text. |
onRowPress? | | | Makes each row a button, reporting its current index. |
disabled? | | | Prevent all row actions. |
haptics? | | | Row activation feedback. |
motion? | | | Row press character. |
className? | | | Classes merged over the root surface. |
style? | | | Native root style. |
testID? | | | Root identifier; rows append |
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 rowaccessibilityLabel. - With
onRowPress, rows become independent buttons. Keep interactive children outside those rows.
Table settings
| Prop | Does | Default |
|---|---|---|
| rows | Ordered label, value, optional id and spoken label | Required |
| title | Heading above the facts | None |
| separators | Hairlines between rows | true |
| surface | raised, outline or filled | outline |
| density | comfortable or compact | comfortable |
| onRowPress | Activates a row by current index | None |
| disabled | Blocks row actions | false |
| haptics | Impact on activation | true |
| motion | Shared row press character | App feel |
| className / style | Root styling | None |
| testID | Root and part identifiers | None |
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
pressmotion role, so it follows your app's feel. Passmotionto 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 on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.