Command palette

@yasinsensoy/native

React Native · Components

Card

Surface grouping content: title, description, content and footer.

3 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Create account

Enter your details, it takes a few seconds.
Free

Card content goes here.

Effects (hover over them)

Lift

effect="lift"

Hover or Tab into it.

Border color

effect="border"

Hover or Tab into it.

Spinning light

effect="beam"

Hover or Tab into it.

Pointer light

effect="glow"

Hover or Tab into it.

3D tilt

effect="tilt"

Hover or Tab into it.

Shine

effect="shine"

Hover or Tab into it.

Tilt + light

effect={["tilt", "glow"]}

Like a platform, the side the pointer presses goes down.

Selected plan

effect={["beam", "lift"]} active

Always on, even without a mouse.

Custom color

--ui-card-accent

Accent color via a CSS variable.

Appearances

outline

Content

elevated

Content

filled

Content

ghost

Content

gradient

Content

glass

Content

dashed

Content

Code

import { Card, Badge, Button } from "@yasinsensoy/native";

<Card
  effect={["beam", "tilt"]}
  title="Create account"
  description="Enter your details, it takes a few seconds."
  icon="user"
  action={<Badge variant="outline">Free</Badge>}
  footer={<Button>Create</Button>}
>
  …
</Card>

Events

  1. Events appear here when you interact with the preview.

Import

import { Card } from "@yasinsensoy/native";

Card

component

Surface grouping content: title, description, content and footer. Same spacing (24 px padding, theme radius + 4), variants and effects as web's Card. The surface is drawn by View; defaults are given via appearance.defaults.card.

Card({ ref, title, description, footer, icon, action, variant, tone, effect, active, onPress, children, style, ...props }: CardProps): JSX.Element

Examples

<Card title="Account" description="Your profile details" footer={<Button>Save</Button>}>
  <TextField label="Name" />
</Card>

<Card variant="glass" effect={["tilt", "glow"]} title="Pro" onPress={select} />
<Card effect="beam" tone="success" active={plan === "pro"} title="Pro" />

Card variant (same names and colors as web's Card variant).

  • outline: bordered surface (default).
  • elevated: with a pronounced shadow.
  • filled: borderless, muted background.
  • ghost: no background or border; layout only.
  • dashed: dashed border, no background.
  • gradient: a gradient from the accent color (tone) into the card.
  • glass: translucent glass surface (no blur; see SurfaceVariant).

Names added via appearance.variants.card can also be given.

type CardVariant = "outline" | "elevated" | "filled" | "ghost" | "dashed" | "gradient" | "glass"

CardProps

interface

Props of Card.

Extends: ViewProps

NameTypeDefaultDescription
ref?Ref<ViewRef>Ref of the underlying native element.
title?ReactNodeTitle.
description?ReactNodeDescription below the title.
footer?ReactNodeFooter (action buttons).
icon?IconPropIcon to the left of the title (in a square box with a muted background).
action?ReactNodeAction on the right of the title row (e.g. a small button or menu).
variant?CardVariant | (string & {})"outline"Variant. Defaults to appearance.defaults.card.variant, otherwise "outline".
tone?Tone"primary"Accent color: the color of effects and the gradient variant.
effect?EffectPropEffect or effects ("lift", ["tilt", "glow"], "beam"…). See BuiltinEffect. Defaults to appearance.defaults.card.effect; otherwise "scale" when onPress is given.
active?booleanfalseKeeps effects on permanently (selected plan, featured card).
onPress?(event: GestureResponderEvent) => voidWhen given, the card becomes pressable (like a list item).
style?StyleProp<ViewStyle>Container style.