Skip to main content

Card

Card container with border, border radius, and optional press handling.

Basic Usage

import { Card, Typography } from '@multinaire/ui';

<Card>
<Typography>Card content</Typography>
</Card>

Props

PropTypeDefaultDescription
isLoadingbooleanfalseShow a loading skeleton in place of the card content
flexnumberFlex grow value
marginSpacingPropsOuter margin. Accepts a number for uniform margin, or an object for per-side control
paddingSpacingPropsInner padding. Accepts a number for uniform padding, or an object for per-side control
widthDimensionValueFixed width of the card
heightDimensionValueFixed height of the card
borderRadiusnumbertheme mediumCorner radius in pixels. Defaults to the theme's medium radius
styleViewStyleAdditional styles applied to the card
selectedbooleanfalseWhen true, the card border color changes to the theme's primary color
backgroundColorColorKeysBackground color key from the active theme palette
borderColorColorKeysbackgroundVariantBorder color key from the active theme palette. Overrides the default backgroundVariant border. Ignored when selected is true
badgeReactElementBadge component rendered as an overlay on the card
testIDstringTest identifier for UI automation
onPress() => voidPress handler. When omitted the card renders as a plain View (fixes web ScrollView scroll freeze)

Examples

Basic Card

<Card padding={16}>
<Typography type="heading">Card Title</Typography>
<Typography color="neutral">Card description</Typography>
</Card>

Pressable Card

<Card onPress={() => handleCardPress()}>
<Typography>Tap me</Typography>
</Card>

Selected State

<Card selected={isSelected} onPress={() => setIsSelected(!isSelected)}>
<Typography>Selectable card</Typography>
</Card>

Custom Colors

<Card backgroundColor="backgroundVariant" borderColor="primary">
<Typography>Custom styled card</Typography>
</Card>

Card with Badge

<Card
badge={<Badge type="primary" title="New" />}
padding={16}
>
<Typography>Card with badge overlay</Typography>
</Card>

Loading Card

<Card isLoading width={200} height={100} />

Custom Sizing

<Card
width="100%"
height={150}
margin={{ bottom: 16 }}
borderRadius={12}
>
<Typography>Full width card</Typography>
</Card>

Notes

  • When onPress is not provided, the card renders as an Animated.View instead of a pressable. This prevents the card from blocking scroll in a ScrollView on web.
  • When onPress is provided, the card renders as a Pressable and animates its opacity on hover (web/desktop) and press.