React Native / Core
Card
Surface that groups related content, with an optional title, subtitle, top-right action and footer. With onPress the whole card is one button.
import { Card } from "@stylhero/native";
Example
import { Badge, Button, Card, Text } from "@stylhero/native";
const noop = () => {};
function CardExample() {
return (
<Card
title="Budget 1440p build"
subtitle="$1,500"
action={<Badge tone="success">Compatible</Badge>}
footer={<Button size="sm" onPress={noop}>Open</Button>}
>
<Text>8 parts, about 140 FPS in Cyberpunk 2077</Text>
</Card>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
action |
ReactNode |
- | Top-right slot next to the title, e.g. a Badge or IconButton. |
children |
ReactNode |
- | |
footer |
ReactNode |
- | Bottom row, right-aligned, e.g. Buttons. |
onPress |
() => void |
- | Makes the whole card one button. Give it an accessibilityLabel if the title isn't enough. |
style |
StyleProp<ViewStyle> |
- | |
subtitle |
string |
- | |
title |
string |
- | |
variant |
"elevated" | "outlined" |
"elevated" |
"outlined" drops the shadow. |
Also takes React Native's View props (testID, accessibilityHint, onLayout…), passed to that View.
Screen reader gestures
| Gesture (VoiceOver / TalkBack) | Does |
|---|---|
| Double-tap | Opens it, with onPress |
Accessibility
- With
onPressthe whole card is one button, read as its title and subtitle; passaccessibilityLabelwhen that isn't enough. Don't put other buttons inside a pressable card.
Generated from src/components/Card.tsx. Something wrong or missing? Open an issue.