Card
Mobile surface: Card + Header/Title/Description/Content/Footer with entering/exiting motion and a default fade-up entrance. Pure View/Text composition.
Install
First install? Set up the registry in your app.
npx --yes --package=https://native.uipkge.dev/cli/uipkge-native-0.1.1.tgz uipkge-native add cardSource files
Expand a file to read the source the installer copies into your app.
components/ui/card/Card.tsx
import * as React from 'react'
import { Text, View, type ViewProps } from 'react-native'
import Animated, { useReducedMotion } from 'react-native-reanimated'
import { cn } from '@/lib/utils'
import { enterFor, exitFor, type EnterPreset, type ExitPreset } from '@/lib/motion'
type CardViewProps = ViewProps & { className?: string }
type CardTextProps = React.ComponentProps<typeof Text> & { className?: string }
/** Cards animate on mount by default (fade-up) — sections arriving in rhythm
* is the signature UIPKGE native feel. Pass `enter="none"` to opt out. */
function Card({
className,
enter = 'fade-up',
exit = 'none',
...props
}: CardViewProps & { enter?: EnterPreset; exit?: ExitPreset }) {
const reduced = useReducedMotion()
return (
<Animated.View
entering={reduced ? undefined : enterFor(enter)}
exiting={reduced ? undefined : exitFor(exit)}
className={cn('border-border bg-card rounded-lg border p-4', className)}
{...props}
/>
)
}
function CardHeader({ className, ...props }: CardViewProps) {
return <View className={cn('mb-2 gap-1', className)} {...props} />
}
function CardTitle({ className, children, ...props }: CardTextProps) {
return (
<Text className={cn('text-card-foreground text-lg font-semibold', className)} {...props}>
{children}
</Text>
)
}
function CardDescription({ className, children, ...props }: CardTextProps) {
return (
<Text className={cn('text-muted-foreground text-sm', className)} {...props}>
{children}
</Text>
)
}
function CardContent({ className, ...props }: CardViewProps) {
return <View className={cn('gap-2', className)} {...props} />
}
function CardFooter({ className, ...props }: CardViewProps) {
return <View className={cn('mt-3 flex-row items-center gap-2', className)} {...props} />
}
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }
components/ui/card/index.ts
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './Card'
Dependencies
Registry items
npm packages
react-native-reanimated