Primitives
Animated Number Avatar Badge Button Button Group Toggle Toggle Group Checkbox Chip Countdown Divider Fab Grid Icon Image Input Search Input Textarea Label Loader Marquee Masked Input Message Bubble Notification Banner Offline Banner Progress Progress Ring Radio Group Range Slider Rating Separator Skeleton Slider Stack Stepper Switch Text Theme Toggle Ticker Typing IndicatorComposed
Accordion Achievement Badge Action Bar Action Sheet Action Swap Activity Rings Add to Cart Button Address Card Agenda List Alert Amount Keypad Animated Icons App Bar Audio Message Audio Recorder Autocomplete Avatar Group Balance Display Bar List Barcode Before After Biometric Gate Bloom Menu Bottom Sheet Paywall Sheet Side Sheet Breadcrumb Calendar Calendar Strip Card Carousel Cart Item Character Charts Chat Composer Chat List Item Choice Card Circle Reveal Coach Marks Collapsible Collapsible Header Color Picker Combobox Command Palette Comment Thread Confetti Consent Sheet Context Menu Copy Field Country Picker Coupon Input Currency Input Data Table Date Range Picker Day Schedule Dialog Dock Donut Chart Drawer Driver Card Dropdown Menu Drum Picker Emoji Picker Empty State Error State Event Card Expandable Control Fader Feature Gate File Picker Filter Bar Follow Button Form Gauge Glass Glass Cluster Glass Dock Morph Glass Fab Morph Glass Lab Glass Orb Glass Search Morph Glass Sheet Edge Gradient Button Headline New Heatmap Image Cropper Image Viewer Kanban Card Keyboard Avoiding Keyboard Toolbar Leaderboard Level Progress Lightbox Like Button Line Chart List Reorderable List Swipeable Row Location Card Location Search Map Sheet Map View Markdown View Media Controls Media Picker Media Tile Mention Input Meter Bar Mini Player Mood Slider Morphing Modal Multi Select Navigation Rail Notification Item Number Input Onboarding Pager Order Card Order Summary OTP Input Pagination Paper Clip New Parallax Header Pass Card Password Strength Payment Button Payment Card Payment Method Permission Primer Phone Input PIN Pad Polaroid New Poll Popover Post Card Postage Stamp New Price Tag Pricing Table Product Card Product Gallery Profile Header Promo Banner Prompt Input Property Card Pull To Refresh QR Code Quick Actions Quick Replies Rating Summary Reaction Picker Resend Timer Review Card Review Prompt Ride Option Save Button Scan Frame Scroll Spy Tabs Seat Map Section Header Section Index Segmented Control Select Share Button Share Sheet Shutter Button Signature Pad Slide to Confirm Slot Picker Smart Banner Social Login Button Sparkline Splash Screen Split Button Stat Card Stateful Button Status Dot Step Flow Steps Sticker New Stopwatch Stories Progress Stories Viewer Story Ring Streak Counter Streaming Text Success Seal Swipe Deck Tabs Tag Input Tape New Text Reveal Thinking Indicator Time Picker Timeline Timer Ring Tip Selector Toast Toolbar Tooltip Track Row Transaction Row Trip Progress Variant Picker Video Controls Waveform Weather Card Weekday Picker Zoom TransitionScreens
Account Switcher Biometric Setup Delete Account Forgot Password Grow Auth Login Login — Dark Stage Login — Dense Work Login — Editorial Login — Illustrated Login — Minimal Ink Login — Social Login — Video Loop Food Onboarding Onboarding Onboarding Dark Objects Onboarding Editorial Onboarding Illustrated Onboarding Personalize Onboarding Photo Carousel OTP Verification Passkey — Create Password Reset Permission — Notifications Phone Verification Onboarding Quiz Session Devices Signup Sign-up Chat Sign-up Photo Sheet Social Auth Split Auth Verify Identity Welcome AI Chat AI Assistant Channels List Chat Info Chat List Chat Media Chat Thread Create Group Group Info Message Requests New Message Kept Messages Accessibility Activity Log Appearance Authenticator Blocked Accounts Export Your Data Downloads Edit Profile Edit Profile — Rows Emergency Call Empty States Set Error State Send Feedback Device Locator Help Center Home — Bento Home — Dark Home — Editorial Home Feed Invite Friends Language & Region Linked Accounts Not Found (404) Notification Settings Notifications Password Vault Paywall Paywall — Comparison Paywall — Dark Stage Paywall — Editorial Paywall — Photo Paywall — Trial Timeline Privacy Profile Profile — Gamified Profile — Minimal Profile — Photo Hero QR Scanner Report Issue Saved Items Phone Time Search Search — Command Palette Search — Visual Account Health Settings Settings — Dark Device Settings — Search Storage & Data Terms & Privacy Dating Chat Dating Filters Profile Discover Its A Match Into You Matches Profile Detail Profile Editor Courier Matching Delivery History Delivery Support Package Schedule Parcel Tracking Proof Of Delivery Quick Aisle Quick Home Send Package Substitutions Add Payment Address Book Cart Categories Checkout Checkout — Steps Checkout Success Delivery Filters & Sort Flash Sale Gift Cards Loyalty Points Order Cancel Order Detail Orders Pay Later Checkout Payment Methods Product Detail Product Detail — Hero Product Grid Product Reviews Promo Codes Recently Viewed Return Items Search Results Shop Assistant Store Home Tip & Rate Courier Order Tracking Wishlist Write a Review Event Checkin Event Hero Events Discover My Tickets Seat Selection Ticket Checkout Add Card Bank Accounts Dashboard — Bento Bill Pay Budgets Card Details Crypto Portfolio Finance Dashboard Dashboard — Dark Exchange Currency Expense List Invoice Detail Manage Cards Plan Management Savings Goals Send Money Spending Analytics Split Bill Subscriptions Token Detail Token Swap Transactions Wallet Home Wallet Movers Courier Tracking Food Cart Food Home Food Orders Grocery List Recipe Detail Restaurant — Dark Restaurant Detail Activity Rings Fitness Home Habit Quest Habit Tracker Meal Planner Med Store Meditation Player Mood Check-in Nutrition Home Period Tracker Prior Auth Prior Auth Cases Quest Complete Run Tracking Rx Scan Sleep Tracker Telehealth Booking Walk Map Water Tracker Workout Complete Workout Detail Workout Session Applications Apply Company Interview Schedule Job Detail Job Feed Resume Saved Jobs Create Listing Item Chat Listing Detail Make Offer Market Checkout Market Home Market Search My Listings Offers Inbox Seller Profile Audiobook Player Camera Gallery Albums Game Store Mini Player Music Player Photo Editor Photo Gallery Playlist Detail Podcast Player Clips Feed Serene Home Sound Mixer Stories Video Call Video Player Article Reader Course Detail Event Detail Memory Onboarding Icon Lab Leaderboard Lesson Player Match Detail News Editorial News Home Plant Care Prediction Live Prediction Welcome Smart Home Standings Ticket Wallet Topics Follow Weather Detail Add Task Sheet Alarm Clock Calendar Day Calendar Month Doc Scanner File Manager Focus Timer Journal Kanban Board Mail Inbox Mail Thread Note Editor Notes List Reminders Task List Time Blocks Agent Profile Compare Homes Mortgage Calculator Property Detail Rental Application Saved Homes Schedule Tour Search List Search Map Complete Destination Driver Arriving Ev Charging History Home In Trip Matching Options Parking Receipt Safety Schedule Scooter Unlock Booking Confirmed Booking Review Booking Slots My Bookings Pro On The Way Provider Detail Provider List Rate Service Services Home Arc Create Arc Detail Arc Onboarding Avatar Creator Comments Sheet Create Post Explore Grid Followers List Hashtag Feed Mentions Post Detail Post Hero Social Profile Boarding Pass Booking Confirm Car Rental Trip Discover Flight Live Flight Preferences Flight Results Flight Search Hotel Detail Live Transit Trip — Map Day Trip — Rideshare Request Seat Select Travel Home Trip Itinerary Trip OnboardingNothing matches — try another word.
Card
Card surface with header, title, content and footer slots and a softly lit edge. It can reveal its parts in reading order as it appears, and its edge can brighten as you press it.
Preview
import * as React from "react";
import { forwardRef } from "react";
import { Platform, StyleSheet, View, Text, type ViewProps, type TextProps, type ViewStyle, type GestureResponderEvent, } from "react-native";
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
} from "react-native-reanimated";
import {
cn,
useHaptic,
usePressAnimation,
AnimatedPressable,
LitEdge,
SwitchOn,
BAND_STAGGER,
timing,
useTheme,
} from "@lumioui/core";
import { Glass } from "../glass";
/**
* Card — compound component:
* <Card>
* <Card.Header><Card.Title /><Card.Description /></Card.Header>
* <Card.Content />
* <Card.Footer />
* </Card>
*
* Pass `onPress` to make the whole card a tactile surface —
* it scales down slightly, fires a light haptic, and exposes
* button accessibility semantics.
*/
export interface CardProps extends ViewProps {
className?: string;
/** Surface voice — "elevated" (default, soft shadow on card color),
* "outlined" (hairline border, no shadow — the paper-canvas idiom),
* "filled" (tonal secondary fill, no shadow),
* "glass" (glass material — floating panels over content). */
variant?: "elevated" | "outlined" | "filled" | "glass";
/** Makes the card pressable: spring scale + light haptic. */
onPress?: (e: GestureResponderEvent) => void;
/** Haptic on press. Default "light"; false to disable. */
haptic?: "light" | "medium" | "heavy" | "selection" | false;
disabled?: boolean;
/**
* Switch the card on as it mounts (opt-in): its parts start dim, then
* each direct child switches on in reading order. Default false.
*/
appear?: boolean;
/**
* Pressable cards only (opt-in): the lit edge brightens with press depth
* (to ~1.6× its strength) as well as the scale dip. Default false.
*/
pressLight?: boolean;
}
/** Appear: parts switch on in reading order on the band rhythm. */
const APPEAR_LEAD = timing.instant.duration;
/** Extra lit-edge strength at full press depth (1 → 1.6). */
const PRESS_LIGHT = 0.6;
// `shadow-card` is a custom boxShadow that only exists on web — native gets
// the same soft lift via shadow* + elevation (button.tsx pattern: the palette
// has no shadow token, so black under both schemes is intentional).
const nativeShadow: ViewStyle | undefined =
Platform.OS === "web"
? undefined
: {
shadowColor: "#000",
shadowOpacity: 0.08,
shadowRadius: 12,
shadowOffset: { width: 0, height: 4 },
elevation: 2,
};
const cardVariants = {
elevated: "rounded-2xl bg-card shadow-card",
// One depth treatment per scheme: hairline on light, surface lightness on dark.
outlined: "rounded-2xl border border-border bg-card dark:border-transparent",
filled: "rounded-2xl bg-secondary",
glass: "rounded-2xl",
} as const;
const CardRoot = forwardRef<React.ElementRef<typeof View>, CardProps>(
function Card(
{
className,
variant = "elevated",
onPress,
haptic = "light",
disabled,
appear = false,
pressLight = false,
children: childrenProp,
style,
...props
},
ref
) {
const haptics = useHaptic();
const press = usePressAnimation({ pressedScale: 0.98 });
// Ink wash — the same held-state veil as List.Item/Fab, so the surface
// confirms the touch even before the scale settles. Opacity-only, so it
// stays as feedback under reduced motion.
const ink = useSharedValue(0);
const inkStyle = useAnimatedStyle(() => ({ opacity: ink.value * 0.05 }));
const pressLightStyle = useAnimatedStyle(() => ({ opacity: ink.value }));
const { scheme } = useTheme();
// Appear: each part switches on in reading order.
const children = appear
? React.Children.toArray(childrenProp).map((child, i) => (
<SwitchOn key={i} delay={APPEAR_LEAD + i * BAND_STAGGER}>
{child}
</SwitchOn>
))
: childrenProp;
const surface = cn(
// Tonal surface — the tinted `background` canvas supplies the edge,
// shadow-card supplies the lift (native gets `nativeShadow` above).
// No p-0 (View has no padding by default) and no shadow-sm (web preset looks dirty on native).
cardVariants[variant],
disabled && "opacity-50",
className
);
// A black drop shadow on a near-black canvas is dead weight: dark lifts
// by surface lightness alone.
const lift = variant === "elevated" && scheme !== "dark" ? nativeShadow : undefined;
const glass = variant === "glass";
// Lit edge on raised tonal surfaces. A caller radius override (rounded-*)
// would leave the 16pt highlight corners outside the curve, so skip it.
const lit = (variant === "elevated" || variant === "filled") && !/\brounded-/.test(className ?? "");
if (!onPress) {
return (
<View ref={ref} className={surface} style={[lift, style]} {...props}>
{glass ? (
<Glass
effect="regular"
sheen={0.4}
className="absolute inset-0 rounded-2xl"
/>
) : null}
{children}
{lit ? <LitEdge tone="surface" radius={16} /> : null}
</View>
);
}
return (
<AnimatedPressable
ref={ref}
disabled={disabled}
onPress={(e) => {
if (haptic) haptics[haptic]();
onPress(e);
}}
onPressIn={() => {
press.onPressIn();
ink.value = withTiming(1, timing.instant);
}}
onPressOut={() => {
press.onPressOut();
ink.value = withTiming(0, timing.normal);
}}
style={[press.animatedStyle, lift, style]}
className={surface}
accessibilityRole="button"
accessibilityState={{ disabled: disabled ?? false }}
// RNW drops the accessibilityState object — mirror as aria-*.
aria-disabled={disabled ?? false}
{...props}
>
{glass ? (
<Glass
effect="regular"
sheen={0.4}
className="absolute inset-0 rounded-2xl"
/>
) : null}
<Animated.View
pointerEvents="none"
style={inkStyle}
className="absolute inset-0 rounded-2xl bg-foreground"
accessibilityElementsHidden
aria-hidden
/>
{children}
{lit ? <LitEdge tone="surface" radius={16} /> : null}
{lit && pressLight ? (
<Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, pressLightStyle]}>
<LitEdge tone="surface" radius={16} strength={PRESS_LIGHT} />
</Animated.View>
) : null}
</AnimatedPressable>
);
}
);
const CardHeader = forwardRef<React.ElementRef<typeof View>, CardProps>(
function CardHeader({ className, ...props }, ref) {
// 20px rhythm (p-5) — p-6 felt cavernous on a 350px phone column.
// `relative` is the default RN position; CardAction anchors to it.
return <View ref={ref} className={cn("relative gap-1.5 p-5", className)} {...props} />;
}
);
const CardAction = forwardRef<React.ElementRef<typeof View>, CardProps>(
function CardAction({ className, ...props }, ref) {
// The header's top-right action slot (menus, "see all").
// Render inside <Card.Header>; absolutely pinned so it never shifts
// the title/description column.
return (
<View
ref={ref}
className={cn("absolute right-5 top-5", className)}
{...props}
/>
);
}
);
export interface CardTextProps extends TextProps {
className?: string;
}
const CardTitle = forwardRef<React.ElementRef<typeof Text>, CardTextProps>(
function CardTitle({ className, ...props }, ref) {
return (
<Text
ref={ref}
// leading-tight (1.25) — leading-none clipped descenders (g, y, p).
// 18pt — the card-title rung (DESIGN-TASTE §2); 20 shouted on a
// phone column next to 15–16pt rows.
className={cn("text-lg font-semibold leading-tight text-card-foreground", className)}
accessibilityRole="header"
{...props}
/>
);
}
);
const CardDescription = forwardRef<React.ElementRef<typeof Text>, CardTextProps>(
function CardDescription({ className, ...props }, ref) {
return (
<Text ref={ref} className={cn("text-[15px] leading-5 text-muted-foreground", className)} {...props} />
);
}
);
const CardContent = forwardRef<React.ElementRef<typeof View>, CardProps>(
function CardContent({ className, ...props }, ref) {
return <View ref={ref} className={cn("p-5 pt-0", className)} {...props} />;
}
);
const CardFooter = forwardRef<React.ElementRef<typeof View>, CardProps>(
function CardFooter({ className, ...props }, ref) {
return (
<View
ref={ref}
className={cn("flex-row items-center gap-3 p-5 pt-0", className)}
{...props}
/>
);
}
);
export const Card = Object.assign(CardRoot, {
Header: CardHeader,
Title: CardTitle,
Description: CardDescription,
Action: CardAction,
Content: CardContent,
Footer: CardFooter,
});
Card.displayName = "Card";
CardHeader.displayName = "CardHeader";
CardAction.displayName = "CardAction";
CardTitle.displayName = "CardTitle";
CardDescription.displayName = "CardDescription";
CardContent.displayName = "CardContent";
CardFooter.displayName = "CardFooter"; import { Card } from "@/components/ui/card/card";
export function Example() {
return (
<Card />
);
} Installation
Usage
import { Card } from "@/components/ui/card/card"; <Card /> Examples
The one place a glass card belongs: floating over the photo it describes, as a place card on a trail map.
import * as React from "react";
import { Image, StyleSheet, View } from "react-native";
import { Card } from "../card";
import { Button } from "../../button/button";
import { Text } from "../../text/text";
const PHOTO =
"https://images.unsplash.com/photo-1476514525535-07fb3b4ae5f1?w=800&q=80&auto=format&fit=crop";
/** CardGlass — the one place a glass card belongs: floating over the photo
* it describes, as a place card on a trail map. Save toggles in place. */
export function CardGlass() {
const [saved, setSaved] = React.useState(false);
return (
<View className="relative h-[480px] w-full overflow-hidden rounded-3xl bg-muted">
<Image source={{ uri: PHOTO }} style={StyleSheet.absoluteFill} resizeMode="cover" accessibilityIgnoresInvertColors />
<View className="absolute inset-x-4 bottom-4">
<Card variant="glass">
<Card.Header>
<Card.Title>Kestrel Lake lookout</Card.Title>
<Card.Description>Ashfall Range · 2.4 km loop</Card.Description>
<Text className="pt-1 text-sm font-medium">Sunrise 7:18 · 6°C, clear</Text>
</Card.Header>
<Card.Footer className="gap-2">
<Button variant="glass" className="flex-1">Directions</Button>
<Button variant="glass" className="flex-1" onPress={() => setSaved((v) => !v)}>
{saved ? "Saved" : "Save"}
</Button>
</Card.Footer>
</Card>
</View>
</View>
);
} A tutor's card in a language-lessons app.
import * as React from "react";
import { View } from "react-native";
import { Easing, useAnimatedProps, useSharedValue, withDelay, withTiming } from "react-native-reanimated";
import Svg from "react-native-svg";
import { Accent, AnimatedPath, ease, timing, useHaptic, useReducedMotion, useTheme } from "@lumioui/core";
import { Card } from "../card";
import { Avatar } from "../../avatar/avatar";
import { Button } from "../../button/button";
import { Icon } from "../../icon/icon";
import { ActionSwapText } from "../../action-swap/action-swap";
import { Text } from "../../text/text";
const CHECK_PATH = "M6 12.5l4 4 8-9";
const CHECK_LEN = 18;
/** The check draws once the button's label has swapped in (dim, then ignite). */
const CHECK_AFTER_SWAP = timing.recede.duration + timing.fast.duration;
function DrawnCheck() {
const { colors } = useTheme();
const reduced = useReducedMotion();
const draw = useSharedValue(reduced ? 1 : 0);
React.useEffect(() => {
if (!reduced) draw.value = withDelay(CHECK_AFTER_SWAP, withTiming(1, { duration: timing.normal.duration, easing: Easing.bezier(...ease.out) }));
}, [reduced, draw]);
const props = useAnimatedProps(() => ({ strokeDashoffset: (1 - draw.value) * CHECK_LEN }));
return (
<Svg width={20} height={20} viewBox="0 0 24 24">
<AnimatedPath d={CHECK_PATH} stroke={colors.primaryForeground} strokeWidth={2.4} strokeLinecap="round" strokeLinejoin="round" fill="none" strokeDasharray={CHECK_LEN} animatedProps={props} />
</Svg>
);
}
/** CardProfile — a tutor's card in a language-lessons app. Book trial does
* its own work: three dots while it books, then it swaps in place to
* "Booked" with a check that draws in, while the caption under the price
* swaps from the lesson length to the booked slot. Nothing leaves or
* reflows: Message stays, because right after booking is when you'd use
* it. Coral is the product. */
export function CardProfile() {
const haptic = useHaptic();
const [booked, setBooked] = React.useState(false);
const book = async () => {
if (booked) return;
await new Promise((r) => setTimeout(r, 1200));
haptic.success();
setBooked(true);
};
return (
<Accent color="coral" className="w-full">
<Card variant="elevated" className="w-full">
<Card.Header className="gap-4">
<View className="flex-row items-center gap-4">
<Avatar size="lg" source={{ uri: "https://i.pravatar.cc/150?img=68" }} fallback="TH" alt="Tomás Herrera" />
<View className="flex-1 gap-1">
<View className="flex-row items-center justify-between gap-2">
<Card.Title>Tomás Herrera</Card.Title>
<View className="flex-row items-center gap-1" accessibilityLabel="Rated 4.9 from 1,240 lessons">
<Icon name="star" size="sm" color="foreground" filled />
<Text className="text-[15px] font-semibold tabular-nums">4.9</Text>
</View>
</View>
<Card.Description numberOfLines={1}>Spanish, Northern accent</Card.Description>
</View>
</View>
<Text className="text-[15px] leading-[22px]">
Conversation-first lessons for travellers and heritage speakers. Lots of slang, very little grammar homework.
</Text>
<View className="flex-row flex-wrap gap-2">
{["Beginner friendly", "Evenings", "Business"].map((t) => (
<View key={t} className="h-8 justify-center rounded-full bg-secondary px-3">
<Text className="text-[13px] text-secondary-foreground">{t}</Text>
</View>
))}
</View>
</Card.Header>
<Card.Footer className="items-center gap-3 border-t border-border pt-4">
<View className="flex-1">
<Text className="text-2xl font-semibold tracking-tight tabular-nums">$28</Text>
<ActionSwapText value={booked ? "slot" : "length"}>
<Text className="text-[13px] text-muted-foreground">{booked ? "Thu 7 PM" : "50 min"}</Text>
</ActionSwapText>
</View>
<Button variant="secondary" accessibilityLabel="Message Tomás">
Message
</Button>
<Button
onPress={book}
icon={booked ? <DrawnCheck /> : undefined}
accessibilityLabel={booked ? "Trial booked for Thursday at 7 PM" : "Book a trial lesson"}
>
{booked ? "Booked" : "Book trial"}
</Button>
</Card.Footer>
</Card>
</Accent>
);
} A rail ticket that switches on as it arrives (dim parts, one sheen, then header → times → footer).
import * as React from "react";
import { View } from "react-native";
import Animated, { Easing, useAnimatedStyle, useSharedValue, withDelay, withSpring, withTiming } from "react-native-reanimated";
import { Accent, ease, rowDelay, spring, timing, useReducedMotion } from "@lumioui/core";
import { Card } from "../card";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
const DETAILS: [string, string][] = [
["Platform", "14b"],
["Coach", "6"],
["Seat", "42A"],
];
/** Container, then content — cells wait for the panel to start opening. */
const CELL_LAG = timing.recede.duration;
const IGNITE = { duration: timing.fast.duration, easing: Easing.bezier(...ease.out) };
const DIM = { duration: timing.recede.duration, easing: Easing.bezier(...ease.in) };
/** One boarding detail — switches on 40ms after its left neighbour. */
function DetailCell({ k, v, i, open }: { k: string; v: string; i: number; open: boolean }) {
const on = useSharedValue(open ? 1 : 0);
React.useEffect(() => {
on.value = open ? withDelay(CELL_LAG + rowDelay(i), withTiming(1, IGNITE)) : withTiming(0, DIM);
}, [open, i, on]);
const style = useAnimatedStyle(() => ({ opacity: on.value }));
return (
<Animated.View style={style} className={`flex-1 items-center ${i > 0 ? "border-l border-border" : ""}`}>
<Text className="text-[13px] text-muted-foreground">{k}</Text>
<Text className="text-xl font-semibold tabular-nums">{v}</Text>
</Animated.View>
);
}
/** The boarding panel grows in place on spring.surface and pushes the
* footer down; closing dims the cells first, then folds on spring.dismiss. */
function BoardingDetails({ open }: { open: boolean }) {
const reduce = useReducedMotion();
const [h, setH] = React.useState(0);
const height = useSharedValue(0);
React.useEffect(() => {
if (!h) return;
const target = open ? h : 0;
height.value = reduce ? target : withSpring(target, open ? spring.surface : spring.dismiss);
}, [open, h, reduce, height]);
const style = useAnimatedStyle(() => ({ height: height.value, overflow: "hidden" }));
return (
<Animated.View style={style} accessibilityElementsHidden={!open} importantForAccessibility={open ? "yes" : "no-hide-descendants"}>
<View
className="absolute left-0 right-0 top-0 pb-5"
onLayout={(e) => setH(e.nativeEvent.layout.height)}
>
<View className="flex-row rounded-2xl bg-secondary py-3">
{DETAILS.map(([k, v], i) => (
<DetailCell key={k} k={k} v={v} i={i} open={open} />
))}
</View>
</View>
</Animated.View>
);
}
/** CardTicket — a rail ticket that switches on as it arrives (dim parts, one
* sheen, then header → times → footer). The whole card is one press target
* whose lit edge brightens with the press; it grows the boarding details in
* place (platform, coach, seat igniting 40ms apart). Teal for travel. */
export function CardTicket() {
const [open, setOpen] = React.useState(false);
return (
<Accent color="teal" className="w-full">
<Card
appear
pressLight
className="w-full"
onPress={() => setOpen((v) => !v)}
accessibilityLabel="Northgate to Marlow Bay ticket"
accessibilityHint={open ? "Hides boarding details" : "Shows boarding details"}
accessibilityState={{ expanded: open }}
>
<View className="flex-row items-center justify-between px-5 pt-5">
<View className="flex-row items-center gap-2">
<View className="h-8 w-8 items-center justify-center rounded-lg bg-primary">
<Icon name="tram-front" size="sm" color="primaryForeground" />
</View>
<Text className="text-[15px] font-semibold">Harbourline Direct</Text>
</View>
<Text className="text-[13px] text-muted-foreground">Fri, Oct 17</Text>
</View>
<View className="flex-row items-end justify-between px-5 pb-5 pt-5">
<View>
<Text className="text-3xl font-semibold tracking-tight tabular-nums">09:36</Text>
<Text className="text-[15px] text-muted-foreground">Northgate C.</Text>
</View>
<View className="items-center pb-1">
<Text className="text-[13px] text-muted-foreground">1 h 16 min</Text>
<View className="mt-1 h-px w-20 bg-border" />
</View>
<View className="items-end">
<Text className="text-3xl font-semibold tracking-tight tabular-nums">10:52</Text>
<Text className="text-[15px] text-muted-foreground">Marlow Bay</Text>
</View>
</View>
<View className="px-5">
<BoardingDetails open={open} />
</View>
<View className="mx-5 mb-5 flex-row items-center justify-between border-t border-border pt-4">
<Text className="text-[15px] text-muted-foreground">1 adult · 2nd class</Text>
<View className="flex-row items-center gap-1">
<Text className="text-[15px] font-semibold text-primary-text">{open ? "Hide details" : "Boarding details"}</Text>
<Icon name={open ? "chevron-up" : "chevron-down"} size="sm" color="primaryText" />
</View>
</View>
</Card>
</Accent>
);
} API reference
Card
className string — variant "elevated" | "outlined" +2
"elevated" | "outlined" | "filled" | "glass" Surface voice — "elevated" (default, soft shadow on card color), "outlined" (hairline border, no shadow — the paper-canvas idiom), "filled" (tonal secondary fill, no shadow), "glass" (glass material — floating panels over content).
—onPress (e: GestureResponderEvent) => void Makes the card pressable: spring scale + light haptic.
—haptic "light" | "medium" | "heavy" +2
"light" | "medium" | "heavy" | "selection" | false Haptic on press. Default "light"; false to disable.
—disabled boolean — appear boolean Switch the card on as it mounts (opt-in): its parts start dim, then each direct child switches on in reading order. Default false.
—pressLight boolean Pressable cards only (opt-in): the lit edge brightens with press depth (to ~1.6× its strength) as well as the scale dip. Default false.
—CardText
className string —