SwipeUI

Minimal listing card

A minimal listing: a rounded photo that pages sideways with dots, a heart to save it, then the title, price line and a star rating.

npx @swipeui/cli add listing-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

  • Stays, homes or rooms people browse and compare by photo, price and rating.
  • A two-column grid or a feed of places, each saved with a heart for later.
  • Listings with several photos people flick through before opening one.
  • Marketplace items where the photo leads and the details are a short line or two.

When not to use it

  • A single featured product on a coloured card. Product spotlight card is designed for that.
  • Campaign or collection heroes with words on the photo. Cover card puts the details in the photo's empty space.
  • Dense lists where each row needs a thumbnail and several actions. Use List row with a leading image.
  • Listings that need booking controls on the card; open a detail screen for dates and guests.

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 listing-card
  • Adds components/swipeui/card/listing-card.tsx, components/swipeui/card/use-listing-card.ts, components/swipeui/card/listing-card-palette.ts and 7 shared helpers.
  • Installs expo-image, react-native-reanimated, react-native-svg, clsx, tailwind-merge, react-native-worklets, uniwind, expo-haptics, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/stays.tsx
import { router } from 'expo-router';
import { ListingCard } from '@/components/swipeui/card/listing-card';

<ListingCard
  images={[{ uri: stay.photoUrl }]}
  title="Home in Mexico City"
  priceLine="£380 for 2 nights"
  rating={4.95}
  onPress={() => router.push(`/stays/${stay.id}`)}
/>;

Examples

app/explore.tsx
import { View } from 'react-native';
import { ListingCard } from '@/components/swipeui/card/listing-card';

// A two-column grid; saved state lives in your data so hearts survive scrolling.
<View className="flex-row gap-3">
  {pair.map((stay) => (
    <ListingCard
      key={stay.id}
      images={stay.photos}
      title={stay.title}
      priceLine={stay.priceLine}
      rating={stay.rating}
      saved={saved.has(stay.id)}
      onSavedChange={(next) => toggleSaved(stay.id, next)}
      onPress={() => openStay(stay.id)}
      className="flex-1"
    />
  ))}
</View>;
app/featured.tsx
import { ListingCard } from '@/components/swipeui/card/listing-card';

// Several photos page sideways with dots; a badge sits at the top start.
<ListingCard
  images={[{ uri: home.photo1 }, { uri: home.photo2 }, { uri: home.photo3 }]}
  title="Home in Lisbon"
  priceLine="£380 for 2 nights"
  rating={4.95}
  badge="Guest favourite"
  imageAspectRatio={4 / 3}
/>;

API reference

ListingCardProps

PropTypeDefaultDescription
imagesreadonly ImageSource[]—

One photo, or several that page sideways with dots. Each fills the frame.

titlestring—

The listing's name, such as "Home in Mexico City". One line.

priceLine?string—

The price and stay, exactly as it should read, such as "£380 for 2 nights".

rating?number—

The average rating out of 5, shown as "★ 4.95" after the price line.

ratingLabel?((value: string) => string)(value) => `rated ${value}`

How the rating is read by screen readers.

badge?ReactNode—

A badge at the photo's top start: a string makes a soft pill, or pass any node.

saved?boolean—

Whether the listing is saved. Pair with onSavedChange to control the heart.

defaultSaved?booleanfalse

Whether it starts saved when uncontrolled.

onSavedChange?((saved: boolean) => void)—

Called with the new saved state when the heart is pressed.

saveable?booleantrue

Shows the heart button at the photo's top end.

saveLabels?readonly [string, string]['Save', 'Saved']

The heart's label when not saved and when saved.

page?number—

The photo on show, zero based. Pair with onPageChange to control paging.

defaultPage?number0

The first photo on show when uncontrolled.

onPageChange?((page: number) => void)—

Called with the photo someone paged to, by swipe or screen-reader action.

dots?booleantrue when there are several photos

Page dots over the photo's bottom edge.

photoLabel?((page: number, count: number) => string)(page, count) => `Photo ${page} of ${count}`

How the current photo is read.

pageActionLabels?readonly [string, string]['Next photo', 'Previous photo']

Names of the screen-reader paging actions.

imageAspectRatio?number1

The photo frame's width divided by its height.

palette?Partial<ListingCardPalette>LISTING_CARD_PALETTE

Colours for the heart and the dots, which sit on the photo.

onPress?(() => void)—

Opens the listing. The heart keeps its own press.

disabled?booleanfalse

Stops the card, the heart and paging, and dims the card.

haptics?booleantrue

A light haptic tap when the card or the heart is pressed.

motion?MotionOverridethe app's feel (smooth without a provider)

Motion for the press, the heart fill (toggle role) and the dots (select role).

accessibilityLabel?stringthe title, price line and rating, joined

What a screen reader announces.

accessibilityHint?string—

Says what pressing does, such as "Opens the listing".

className?string—

Classes merged over the root.

style?StyleProp<ViewStyle>—

Native style escape hatch for the root.

testID?string—

Root identifier; parts add -card, -photos, -photo-<n>, -dots, -controls, -save and -badge.

Composition and behavior

  • A rounded images frame (square by default) leads; the title (one line), then the priceLine and a rating shown as ★ 4.95 sit under it. The card has no outline.
  • With onPress the whole card is one press target. The heart at the photo's top end is its own 44pt button, so saving never opens the card.
  • Several images page sideways with snapping and dots. Screen readers hear "Photo 2 of 3" and get Next photo and Previous photo actions.
  • saved and page work controlled or uncontrolled; keep saved state in your data so it survives lists and screens.
  • badge sits at the photo's top start. The badge and heart row follows the reading direction, so they swap sides in right-to-left layouts.

Save settings

PropDoesDefault
saveableShows the heart buttontrue
saved / defaultSavedWhether the listing is saveduncontrolled, false
onSavedChangeCalled with the new saved statenone
saveLabelsThe heart's label before and after savingSave, Saved
paletteHeart and dot colours on the photoLISTING_CARD_PALETTE

Photo settings

PropDoesDefault
imagesOne photo, or several that pagerequired
page / defaultPageThe photo on showuncontrolled, 0
onPageChangeCalled with the photo someone paged tonone
dotsPage dots over the phototrue with several photos
photoLabelHow the current photo is readPhoto 1 of 3
pageActionLabelsNames of the screen-reader paging actionsNext photo, Previous photo
imageAspectRatioThe photo frame's shape1

Behavior and gestures

  • Tap the card to open the listing: it presses in slightly with a light haptic.
  • Tap the heart at the photo's top end to save; it fills on the toggle role and has its own press, so it never opens the card. saved with onSavedChange controls it, defaultSaved sets the start, saveable={false} removes it.
  • With several images, swipe the photo sideways to page; the dots follow on the select role. page with onPageChange controls the photo, defaultPage sets the first one, dots={false} hides the dots.
  • badge puts a pill (for a string) or any node at the photo's top start.
  • disabled dims the card and stops the card, the heart and paging; haptics={false} turns off the taps.

Accessibility

  • The card is one element read as the title, price line and rating, such as "Home in Lisbon, £380 for 2 nights, rated 4.95"; ratingLabel changes how the rating is read.
  • With several photos it also reads "Photo 2 of 3" and offers Next photo and Previous photo actions; photoLabel and pageActionLabels translate them.
  • The heart is a separate 44pt button whose label switches between Save and Saved (saveLabels) and reports its selected state.
  • Photos and dots are decorative. Under Reduce Motion the heart fills at once and paging by action jumps without scrolling.
  • The badge and the heart sit in a row that follows the reading direction, so they swap sides in right-to-left layouts.

Motion

  • Uses the press, toggle and select motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • The card and the heart scale on the press role.
  • The heart's fill grows in and fades out on the toggle role; the current page dot brightens and grows on the select role.
  • Under Reduce Motion the fill and dots change at once and programmatic paging doesn't animate.

Performance

  • Photos load through expo-image; with several photos all are mounted in one paging scroll view, so keep the count small (three to five) and size images to the frame.

Notes for AI

  • Never name the card after a rental site; it is the Minimal listing card.
  • Pass priceLine already formatted, such as "£380 for 2 nights", and rating as a number.
  • Store saved state in your own data with saved and onSavedChange so hearts survive scrolling and screens.
  • Use badge for one short status such as "Guest favourite"; keep actions other than save off the card.

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