Info card
A topic, its description, a chip and a chevron on a deep, softly curved surface, in large, medium and small sizes.
npx @swipeui/cli add info-cardWhen to use it
- A list of topics people open for more, such as plans, guides, settings groups or catalogue entries, each with a short description.
- Marking one topic with a status or tier, such as Free, New or Beta, in the top-end chip.
- A two-column grid of tappable tiles on a home or explore screen (medium).
- A dense stack of short entries where each still deserves a card, such as recent documents (small).
When not to use it
- Long lists of similar rows, such as settings or contacts. List row is lighter and easier to scan.
- Content that opens in place. Expandable card grows into a full-width panel instead of navigating.
- A number that matters more than the words. Metric card puts the value first.
- Image-led content. Cover card, Minimal listing card and Product spotlight card lead with the photo.
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 info-card- Adds
components/swipeui/card/info-card.tsxand 6 shared helpers. - Installs class-variance-authority, react-native-svg, uniwind, react-native-reanimated, react-native-worklets, clsx, tailwind-merge, expo-haptics. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { InfoCard } from '@/components/swipeui/card/info-card';
<InfoCard
title="Card"
description="A token-based surface with media, header, body and footer slots."
chip="Free"
onPress={() => router.push('/components/card')}
/>;Examples
import { InfoCard } from '@/components/swipeui/card/info-card';
<View className="flex-row gap-3">
<InfoCard size="medium" title="Daily plan" description="Three focus blocks." chip="New" onPress={openPlan} className="flex-1" />
<InfoCard size="medium" title="Weekly review" description="What moved, what stalled." onPress={openReview} className="flex-1" />
</View>;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
InfoCardProps
| Prop | Type | Default | Description |
|---|---|---|---|
title | | — | The topic, shown first and read first. |
description? | | — | Supporting text under the title. Large shows three lines, medium two and small one. |
chip? | | | A chip: top end in large, beside the chevron in medium, before it in small. A string renders a soft pill; pass any node (a Badge, a price, a status dot) for full control. |
leading? | | | Leading icon or artwork: above the title in medium, at the start in small and large. |
size? | | | Layout. |
surface? | | | Surface treatment. |
surfaceBackground? | | | Decorative replacement for the card fill. It receives the card’s bounds. |
chevron? | | | Show the trailing chevron that says the card opens more. |
disabled? | | | Prevent activation and dim the card. |
haptics? | | | Impact feedback when pressed. |
motion? | | | Press character. |
onPress? | | — | Opens the detail. Without it the card is a static surface. |
accessibilityLabel? | | | What a screen reader announces. |
accessibilityHint? | | — | Describes the result of pressing, such as "Opens the plan details". |
className? | | — | Classes merged over the surface. |
style? | | — | Native style escape hatch for the surface. |
testID? | | — | Root identifier. |
Composition and behavior
- size sets the layout:
largeis a long row with the chevron centred at the end,mediuma tile for two-column grids,smalla compact row. - chip sits at the top end in large, beside the chevron in medium (so titles line up across a grid row) and before the chevron in small. A string becomes a soft pill; any node, such as a Badge, replaces it.
- leading takes an icon or artwork: above the title in medium, at the start in small and large.
- surface
raiseduses the deepershadow-raisedlift and a hairline;outlineandfilledare quieter. - With onPress the whole card is one button and shows the chevron; without it the card is static.
Behavior and gestures
- Use surfaceBackground for a decorative fill, such as the Pro Glass material.
- With onPress, the whole card is one button: it presses in slightly, gives a light haptic and springs back.
- Without onPress it's a static surface and the chevron is hidden unless you turn it on.
- The chip is display only; put separate actions outside the card so there is one target per card.
- Disabled cards dim and ignore touches.
Accessibility
- The card is read as one element: the title, the description and a string chip, for example "Card, A token-based surface, Free".
- Pass accessibilityLabel when the chip is a custom node so its meaning is still spoken.
- Pressable cards are buttons with at least a 44pt target; add accessibilityHint to say where they lead.
- Text follows Dynamic Type; descriptions wrap to three, two or one lines by size and then truncate.
- The chevron mirrors in right-to-left layouts and is hidden from screen readers.
Motion
- Uses the
pressmotion role, so it follows your app's feel. Passmotionto tune this one instance. - Pressing scales the card using the app's press feel, interrupted cleanly if the finger moves away.
- With Reduce Motion the card stays still and only the haptic and action remain.
Performance
- No state or timers; the chevron is one small vector, so long lists stay cheap.
Notes for AI
- Use size large for full-width lists, medium inside a two-column grid and small for dense stacks.
- Pass chip as a short string for the built-in pill, or a node such as <Badge variant="success">Live</Badge> for custom styling.
- Set chevron only when the card navigates; leave onPress unset for informational cards.
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.