Card

Cardは、関連するコンテンツをグループ化して表示するためのコンテナコンポーネントです。 ヘッダー、コンテンツ、フッターの構造で情報を整理し、画像やアクションを含む多様なレイアウトに対応します。

3
Variants
3
Sizes
2
Orientations
Pure
React

Playground

Preview
D

Card Title

Card description goes here.

This is the main content area of the card. It can contain any content.

Variant
Size
Radius
Direction
Options
<Card>
  <CardHeader>
    <CardTitle icon={<Layers />}>Card Title</CardTitle>
    <CardDescription>Card description goes here.</CardDescription>
  </CardHeader>
  <CardContent>
    <p className="text-sm text-text-muted">
      This is the main content area of the card. It can contain any content.
    </p>
  </CardContent>
  <CardFooter>
    <Button size="sm" variant="ghost" className="ml-auto" rightIcon={<ChevronRight />}>
      Learn more
    </Button>
  </CardFooter>
</Card>

Variants

3つのバリアントで、カードの視覚的な重要度を制御できます。

Default

Default

シャドウで浮き上がるスタイル

メインUI
Outline

Outline

ボーダーのみのフラットなスタイル

リスト・グリッド
Ghost

Ghost

背景・ボーダーなしの最小スタイル

グループ内

Sizes

sm
16px
20px
内部下12px
末尾下20px
default
24px
24px
内部下16px
末尾下24px
lg
32px
32px
内部下16px
末尾下32px

レスポンシブ: default・lgサイズはモバイル(640px未満)で自動的にパディングが一段階小さくなります。 smサイズは固定値です。

Features

Orientation

垂直・水平のレイアウト方向を切り替えられます。水平レイアウトでは画像が左側に配置されます。

Vertical (Default)

Image Area

Vertical Card

Image on top, content below.

Horizontal

Preview

Horizontal Card

Image on left, content on right.

Header Action

Notifications

You have 3 unread messages.

Image Overlay

Beach

Tropical Beach

Discover the most beautiful beaches.

Customization

overlayOpacityoverlayClassNameで画像オーバーレイをカスタマイズできます。

透明度の調整

Beach

ライト (30%)

Beach

デフォルト (60%)

Beach

ダーク (80%)

<CardImage overlay overlayOpacity={30} /> {/* ライト */} <CardImage overlay /> {/* デフォルト 60% */} <CardImage overlay overlayOpacity={80} /> {/* ダーク */}

フルカスタマイズ

{/* グラデーション方向を変更 */} <CardImage overlay overlayClassName="from-black/60 bg-gradient-to-b" /> {/* カラーオーバーレイ */} <CardImage overlay overlayClassName="from-blue-900/50" />

Tip:overlayClassNameを指定するとoverlayOpacityより優先されます。グラデーション方向や色を自由に変更できます。

API

Component Structure

Card— Radix Slot
.ImageProps.HeaderProps.TitleProps.DescriptionProps.ActionProps.ContentProps.FooterProps

Props

Card

variant"default"
"default" | "outline" | "ghost"

カードのビジュアルスタイル

size"default"
"sm" | "default" | "lg"

コンテンツのパディングスケール(レスポンシブ対応)

radius"xl"
"sm" | "base" | "md" | "lg" | "xl" | "2xl"

角丸の大きさ (2/4/6/8/12/16px)

direction"vertical"
"vertical" | "horizontal"

レイアウト方向

interactivefalse
boolean

ホバー時のシャドウ強化・リフト効果(クリック可能なカード用)

asChildfalse
boolean

Slotパターンで子要素として描画

CardTitle

iconundefined
React.ReactNode

タイトルの先頭に表示するアイコン

CardImage

overlayfalse
boolean

グラデーションオーバーレイを表示

overlayOpacity60
number

オーバーレイの透明度(10〜90)

overlayClassNameundefined
string

オーバーレイのカスタムクラス(overlayOpacityより優先)

alt""
string

画像の代替テキスト

CardHeader / CardContent / CardFooter / CardAction / CardDescription

標準のHTMLDivAttributes(CardDescriptionはHTMLParagraphAttributes)を継承。カードのsizeコンテキストに基づいてパディングが自動調整されます。