Documentation Index
Fetch the complete documentation index at: https://mintlify.com/awasserz/rippler-app/llms.txt
Use this file to discover all available pages before exploring further.
Card Component
TheCard component is a versatile container with an elevation system that automatically adjusts background colors based on the theme. It includes optional title and description props, animated press feedback, and flexible children support.
Import
Basic Usage
Props
Elevation level that determines the background color:
0:theme.backgroundRoot1:theme.backgroundDefault2:theme.backgroundSecondary3:theme.backgroundTertiary
Optional title displayed at the top of the card using ThemedText with
h4 typographyOptional description displayed below the title with reduced opacity (0.7) and
small typographyContent to render inside the card
Callback function invoked when the card is pressed. When provided, the card becomes interactive with press animations
Additional styles to apply to the card container
Real-World Examples
Goals Screen Input Groups
FromGoalsScreen.tsx:156-161:
Elevation System
The Card component uses a semantic elevation system for visual hierarchy:- Elevation 0
- Elevation 1 (Default)
- Elevation 2
- Elevation 3
Background:
theme.backgroundRootUsed for the lowest level, typically matching the root background.Animation Behavior
WhenonPress is provided, the Card becomes animated:
Press Animation
- Press In: Scales down to 0.98
- Press Out: Springs back to 1.0
- Spring Config: Same configuration as Button for consistency
Styling
Default Styles
Custom Styling Example
Layout Patterns
Vertical Stack
Horizontal Grid
TypeScript Interface
Background Color Helper
The Card uses an internal helper function to determine background color:Best Practices
Use elevation consistently
Use elevation consistently
Maintain a consistent elevation hierarchy across your app:
Combine title and children thoughtfully
Combine title and children thoughtfully
Use the title prop for simple headers, but use children for complex headers:
Use onPress for navigation
Use onPress for navigation
Accessibility
- When
onPressis provided, the card becomes a pressable element - Title uses semantic heading typography (
h4) - Description has reduced opacity for visual hierarchy
- Animated feedback provides clear interaction cues
Source Code
Location:client/components/Card.tsx
The Card component is built using:
react-native-reanimatedfor press animationsThemedTextfor title and descriptionuseThemehook for elevation-based backgroundsAnimated.createAnimatedComponent(Pressable)for interactive cards