EXITN

Card

다양한 변형과 애니메이션 효과를 가진 세련된 카드 컴포넌트

Card

콘텐츠를 우아하게 표시하는 유연한 카드 컴포넌트입니다. 다양한 스타일 변형과 부드러운 호버 효과를 제공합니다.

설치

pnpm dlx shadcn@latest add https://n-exit.io/r/card.json

주요 특징

  • 6가지 스타일 변형: 기본, 상승, 아웃라인, 플랫, 그라디언트, 글래스
  • 🎭 4가지 호버 효과: 리프트, 스케일, 글로우, 보더 변화
  • 📏 4가지 크기 옵션: 작음부터 매우 큰 크기까지
  • 🎨 7가지 그림자 강도: 없음부터 2xl까지
  • 🔄 완전한 반응형: 모든 디바이스에서 완벽하게 작동

기본 사용법

카드 제목

카드 설명이 여기에 들어갑니다

카드 콘텐츠가 여기에 들어갑니다.

import { 
  Card, 
  CardHeader, 
  CardTitle, 
  CardDescription, 
  CardContent, 
  CardFooter 
} from '@/nexit-ui/components/ui/card'

export function BasicCard() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>카드 제목</CardTitle>
        <CardDescription>카드 설명이 여기에 들어갑니다</CardDescription>
      </CardHeader>
      <CardContent>
        <p>카드 콘텐츠가 여기에 들어갑니다.</p>
      </CardContent>
      <CardFooter>
        <Button>액션</Button>
      </CardFooter>
    </Card>
  )
}

스타일 변형

기본 (Default)
상승 (Elevated)
아웃라인 (Outlined)
플랫 (Flat)
그라디언트 (Gradient)
글래스 (Glass)
<Card variant="default">
  <CardContent>기본 스타일</CardContent>
</Card>
<Card variant="elevated">
  <CardContent>그림자로 들어올린 스타일</CardContent>
</Card>
<Card variant="outlined">
  <CardContent>강조된 테두리 스타일</CardContent>
</Card>
<Card variant="flat">
  <CardContent>플랫한 배경 스타일</CardContent>
</Card>
<Card variant="gradient">
  <CardContent>그라디언트 배경 스타일</CardContent>
</Card>
<Card variant="glass">
  <CardContent>글래스모피즘 스타일</CardContent>
</Card>

호버 효과

리프트 효과
스케일 효과
글로우 효과
보더 효과
<Card hover="lift" isHoverable>
  <CardContent>호버 시 위로 올라가는 효과</CardContent>
</Card>
<Card hover="scale" isHoverable>
  <CardContent>호버 시 크기가 커지는 효과</CardContent>
</Card>
<Card hover="glow" isHoverable>
  <CardContent>호버 시 빛나는 효과</CardContent>
</Card>
<Card hover="border" isHoverable>
  <CardContent>호버 시 테두리 변화 효과</CardContent>
</Card>

Interactive Cards

Pressable Card

<Card isPressable onPress={() => console.log("Card pressed")}>
  <CardContent>Click me!</CardContent>
</Card>

Hoverable Card

<Card isHoverable hover="lift">
  <CardContent>Hover over me</CardContent>
</Card>

Shadow Options

<Card shadow="none">No shadow</Card>
<Card shadow="sm">Small shadow</Card>
<Card shadow="default">Default shadow</Card>
<Card shadow="md">Medium shadow</Card>
<Card shadow="lg">Large shadow</Card>
<Card shadow="xl">Extra large shadow</Card>
<Card shadow="2xl">2X large shadow</Card>

Radius Options

<Card radius="none">Sharp corners</Card>
<Card radius="sm">Small radius</Card>
<Card radius="default">Default radius</Card>
<Card radius="lg">Large radius</Card>
<Card radius="xl">Extra large radius</Card>
<Card radius="2xl">2X large radius</Card>
<Card radius="full">Full radius</Card>

Animation Controls

{
  /* Disable animations */
}
<Card disableAnimation>
  <CardContent>No animations</CardContent>
</Card>;

{
  /* Disable ripple effects */
}
<Card disableRipple>
  <CardContent>No ripple effects</CardContent>
</Card>;

API Reference

Card Props

PropTypeDefaultDescription
variantstring"default"Card style variant
sizestring"default"Card padding size
radiusstring"default"Border radius
shadowstring"default"Shadow intensity
hoverstring"none"Hover effect type
isHoverablebooleanfalseEnable hover effects
isPressablebooleanfalseEnable press effects
disableAnimationbooleanfalseDisable animations
disableRipplebooleanfalseDisable ripple effects
onPressfunction-Press callback
asChildbooleanfalseRender as child element

Variant Options

VariantDescription
defaultStandard card with border
elevatedCard with shadow elevation
outlinedThick border, enhanced outline
flatMuted background, no border
gradientGradient background
glassSemi-transparent with blur

Size Options

SizeDescription
smSmall padding (16px)
defaultDefault padding (24px)
lgLarge padding (32px)
xlExtra large padding (40px)

Hover Options

HoverDescription
noneNo hover effect
liftLift up with shadow
scaleScale up slightly
glowGlow effect around card
borderBorder color change

Shadow Options

ShadowDescription
noneNo shadow
smSmall shadow
defaultDefault shadow
mdMedium shadow
lgLarge shadow
xlExtra large shadow
2xl2X large shadow

Card Components

CardHeader

Container for card title and description with bottom padding.

CardTitle

Semantic heading element for the card title.

CardDescription

Muted text for card description or subtitle.

CardContent

Main content area of the card.

CardFooter

Footer area with top padding, typically for actions.

실제 사용 예시

제품 이미지

멋진 제품

당신의 삶을 바꿀 놀라운 제품입니다.

₩99,000

₩129,000

export function ProductCard() {
  return (
    <Card variant="elevated" hover="lift" isHoverable className="max-w-sm">
      <CardHeader>
        <img 
          src="/product.jpg" 
          alt="Product" 
          className="w-full h-48 object-cover rounded-lg"
        />
      </CardHeader>
      <CardContent className="space-y-3">
        <CardTitle>멋진 제품</CardTitle>
        <CardDescription>당신의 삶을 바꿀 놀라운 제품입니다.</CardDescription>
        <div className="flex items-center justify-between">
          <span className="text-2xl font-bold">₩99,000</span>
          <span className="text-sm text-muted-foreground line-through">
            ₩129,000
          </span>
        </div>
      </CardContent>
      <CardFooter>
        <Button variant="primary" size="lg" className="w-full h-11 font-semibold">
          🛒 장바구니에 추가
        </Button>
      </CardFooter>
    </Card>
  )
}

분석 데이터

월간 성과

₩12,345,000

지난달 대비 +12.5%

export function DashboardCard() {
  return (
    <Card variant="glass">
      <CardHeader>
        <div className="flex items-center justify-between">
          <CardTitle>분석 데이터</CardTitle>
          <TrendingUpIcon className="h-5 w-5 text-green-500" />
        </div>
        <CardDescription>월간 성과</CardDescription>
      </CardHeader>
      <CardContent>
        <div className="text-3xl font-bold">₩12,345,000</div>
        <p className="text-sm text-green-500">지난달 대비 +12.5%</p>
      </CardContent>
    </Card>
  )
}

알림 설정

알림 기본 설정을 관리하세요

새로운 업데이트를 이메일로 받아보세요
브라우저 푸시 알림을 받아보세요
중요한 알림을 문자로 받아보세요
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/nexit-ui/components/ui/card"
import { Button } from "@/nexit-ui/components/ui/button"
import { Switch } from "@/nexit-ui/components/ui/switch"

export function SettingsCard() {
  return (
    <Card variant="flat">
      <CardHeader>
        <CardTitle>알림 설정</CardTitle>
        <CardDescription>알림 기본 설정을 관리하세요</CardDescription>
      </CardHeader>
      <CardContent className="space-y-4">
        <div className="flex items-center justify-between py-2">
          <div className="flex flex-col">
            <label className="font-medium text-sm">이메일 알림</label>
            <span className="text-xs text-muted-foreground">
              새로운 업데이트를 이메일로 받아보세요
            </span>
          </div>
          <Switch id="email-notification" />
        </div>
        <div className="flex items-center justify-between py-2">
          <div className="flex flex-col">
            <label className="font-medium text-sm">푸시 알림</label>
            <span className="text-xs text-muted-foreground">
              브라우저 푸시 알림을 받아보세요
            </span>
          </div>
          <Switch id="push-notification" />
        </div>
        <div className="flex items-center justify-between py-2">
          <div className="flex flex-col">
            <label className="font-medium text-sm">SMS 알림</label>
            <span className="text-xs text-muted-foreground">
              중요한 알림을 문자로 받아보세요
            </span>
          </div>
          <Switch id="sms-notification" />
        </div>
      </CardContent>
      <CardFooter className="gap-3 pt-6">
        <Button variant="outline" size="sm" className="flex-1 h-9 font-medium">
          취소
        </Button>
        <Button variant="primary" size="sm" className="flex-1 h-9 font-medium">
          변경사항 저장
        </Button>
      </CardFooter>
    </Card>
  )
}

Card 컴포넌트는 콘텐츠를 체계적으로 구성하고 아름다운 애니메이션과 상호작용을 제공하는 다용도 기반 요소입니다.