Tac UIv1.1.2

Card

A versatile container for grouping related content with multiple visual variants and optional press interaction.

Import

tsx
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@tac-ui/native';

Playground

Interactively configure the Card props below.

Card Title
A summary of your current project status.
tsx
<Card variant="default">
  <CardHeader>
    <CardTitle>Card Title</CardTitle>
    <CardDescription>A summary of your current project status.</CardDescription>
  </CardHeader>
  <CardContent>Track progress, manage tasks, and collaborate with your team.</CardContent>
</Card>

Default

The default card variant uses a bordered surface with a subtle shadow, composed with CardHeader, CardTitle, CardDescription, CardContent, and CardFooter sub-components.

Project Overview
A summary of your current project status.
tsx
<Card>
  <CardHeader>
    <CardTitle>Project Overview</CardTitle>
    <CardDescription>A summary of your current project status.</CardDescription>
  </CardHeader>
  <CardContent>Track progress, manage tasks, and collaborate with your team.</CardContent>
  <CardFooter>
    <Button variant="outline" size="sm">Details</Button>
  </CardFooter>
</Card>

Variants

Three visual styles are available: default (bordered surface with shadow), accent (colored border), and flat (no border or shadow).

Default
The default card variant.
Accent
The accent card variant.
Flat
The flat card variant.
tsx
<Card variant="default">
  <CardHeader>
    <CardTitle>Default</CardTitle>
    <CardDescription>The default card variant.</CardDescription>
  </CardHeader>
</Card>
<Card variant="accent">
  <CardHeader>
    <CardTitle>Accent</CardTitle>
    <CardDescription>The accent card variant.</CardDescription>
  </CardHeader>
</Card>
<Card variant="flat">
  <CardHeader>
    <CardTitle>Flat</CardTitle>
    <CardDescription>The flat card variant.</CardDescription>
  </CardHeader>
</Card>

Interactive

Setting interactive enables a press scale animation, making the card behave like a tappable element.

Clickable Card
Tap to see the press effect.
tsx
<Card interactive onPress={() => console.log('card pressed')}>
  <CardHeader>
    <CardTitle>Clickable Card</CardTitle>
    <CardDescription>Tap to see the press effect.</CardDescription>
  </CardHeader>
</Card>

API Reference

PropTypeDefaultDescription
variant"default" | "accent" | "flat""default"Visual style of the card.
interactivebooleanfalseEnables press scale animation. Automatically enabled when onPress is provided.
onPress() => void-Press handler. Implicitly enables interactive mode when set.
childrenReact.ReactNode-Card content — typically CardHeader, CardContent, and CardFooter sub-components.
styleViewStyle-Additional React Native style applied to the card container.

Sub-component API Reference

PropTypeDefaultDescription
CardHeaderViewProps-Vertical container with a small gap for CardTitle and CardDescription.
CardTitleViewProps & { children }-Renders a semibold title. Strings are auto-wrapped in a Text component.
CardDescriptionViewProps & { children }-Renders muted descriptive text below the title.
CardContentViewProps-Unstyled container for the main card body content.
CardFooterViewProps-Horizontal row container for action buttons and footer elements.