Card

A surface that groups a title, a description, content and actions, in outline, solid or ghost.

import { Card } from "@plexui/react-native"

Examples

Overview

Colored

Group

Suggestion

Platforms

iOS 26Android
Native componentNone: a section on the grouped backgroundNone: a section card of a settings screen
LookA white section with 26pt cornersA white section card with 16dp corners and no border, on the gray page

API

Card

PropTypeDefaultDescription
childrenReactNode—The card's parts
variant"outline" | "solid" | "ghost" | "elevated""outline"Fill style. `elevated` lifts the card off the page: on iOS the section's fill with a floating control's soft shadow, on Android Material's elevated card (the low container at level 1)
size"sm" | "md" | "lg""md"The padding: 12, 16 or 20 on iOS; 12, 16 or 24 on Android
color"accent" | "primary" | "info" | "success" | "warning" | "caution" | "danger" | "discovery"—Fills the card with a color of the palette in place of its variant's surface; the title, text and icons take the color made for it, the description that color at 80%
onPress() => void—Makes the whole card a button, or with pressTarget title a card that opens on a tap and keeps its own controls
pressTarget"card" | "title""card"What a screen reader and the keyboard reach onPress by. card: the whole card is one button, holding no controls of its own. title: a tap anywhere still opens the card, but its Card.Title is the button (named by accessibilityLabel), and the card's own buttons, links and page control stay controls of their own (on the web no button in a button)
interactivebooleanfalseShows the press of a card whose own parts take it
accessibilityLabelstring—Name of the card for screen readers
testIDstring—Test id
styleStyleProp<ViewStyle>—Style of the card

Card.Media

PropTypeDefaultDescription
sourceImageSourcePropType—The picture: a bundled image or { uri }
fillstring—The media where there is no picture: a color or a CSS gradient; --media-card-fill by default
backgroundReactNode—Anything drawn as the media (a video, an animation), under the scrim and the words
size"md" | "lg""md"md: a caption over the picture's foot. lg: a suggestion card (Title 2 bold, a meta row, an action); on Android the words under the media
aspectRationumber16 / 9 (4 / 5 at lg)Width over height
heightnumber—A height instead of a ratio (--media-card-height too)
metaReactNode—A row under the words, such as a symbol and a time, in the words' color
actionReactNode—An action at the end of the meta row, such as a small capsule Button
accessibilityLabelstring—The picture's description for screen readers; without it the picture is decorative
titleReactNode—Caption title over the bottom of the picture
descriptionReactNode—Caption text under the title
childrenReactNode—Anything else over the picture, at its bottom
testIDstring—Test id

Compound parts

PartPropsPurpose
Card.Headerchildren, align (start or center, default start), style, testIDThe title and description, with a Card.Action at the end: on the title's line, or with center on the middle of the words
Card.TitlechildrenThe card's heading, announced as a header
Card.DescriptionchildrenSecondary text under the title by --title-description-gap; a second one stands under the first as its next line
Card.Contentchildren, style, testIDThe body of the card
Card.Footerchildren, style, testIDThe buttons at the bottom, at the end on Android
Card.Actionchildren, style, testIDActions at the end of the header, such as a menu or a close button, in a row --card-action-gap apart (12 on iOS, --card-action-gap-android 8 on Android)
Card.Valuechildren, style, testIDA figure at the end of the header, in the accent
Card.Groupchildren, joined (default true), style, testIDCards joined in one inset grouped section with hairlines between them, or --card-group-gap apart

useCardMetrics

useCardMetrics(size) returns { inset, gap, radius }: cardMetrics's two for the size, and radius, the corner of a card standing alone on this platform (iOS --card-radius, 26; Android 16dp, or a brand's --card-radius when it sets one), for a block of the app's own laid beside cards, as a photo with the cards' corners.

import { useCardMetrics } from "@plexui/react-native"

const { radius } = useCardMetrics()
<Image source={photo} style={{ borderRadius: radius }} />

cardMetrics

cardMetrics(theme, size) returns { inset, gap } for a size: inset, the room inside the card's edge (a ghost card keeps none; a picture's caption keeps it), and gap, the room between its parts (on iOS the spacing steps 12, 16 and 20; on Android three quarters of the inset). A part that keeps room of its own inside its frame can give some of the gap back with them:

import { Card, cardMetrics, useTheme } from "@plexui/react-native"

const theme = useTheme()
const { gap } = cardMetrics(theme, "md")
// A row under the picture that stands 8 under it rather than the card's gap
<View style={{ marginTop: 8 - gap }} />