Skip to content
Stylhero 0.6.2
React Native

Theme

Core

Feedback

Inputs

Navigation

Overlays

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

PropTypeDefaultDescription
action ReactNode - Top-right slot next to the title, e.g. a Badge or IconButton.
children ReactNode -
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-tapOpens it, with onPress

Accessibility

  • With onPress the whole card is one button, read as its title and subtitle; pass accessibilityLabel when 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.