카드
카드 (Card)
Card는 콘텐츠를 쉽게 읽을 수 있게 묶어서 보여주는 데 사용해요.
출처: 문서
본문
Card는 콘텐츠를 쉽게 읽을 수 있는 방식으로 그룹 지어 보여주는 데 사용해요.
| 클래스명 | 타입 | 설명 |
|---|---|---|
| card | 컴포넌트 | Card |
| card-title | 파트 | 제목 파트 |
| card-body | 파트 | 본문(콘텐츠) 파트 |
| card-actions | 파트 | 액션(버튼 등) 파트 |
| card-border | 스타일 | <card>에 테두리 추가 |
| card-dash | 스타일 | dash 스타일 |
| card-side | 수정자 | <figure>의 이미지를 옆에 배치 |
| image-full | 수정자 | <figure> 요소의 이미지를 배경으로 사용 |
| card-xs | 크기 | 매우 작은 크기 |
| card-sm | 크기 | 작은 크기 |
| card-md | 크기 | 중간 크기 (기본값) |
| card-lg | 크기 | 큰 크기 |
| card-xl | 크기 | 매우 큰 크기 |
Card
카드 컴포넌트는 figure, body 파트를 갖고, body 안에는 title과 actions 파트가 있어요.
<div class="$$card bg-base-100 w-96 shadow-sm">
<figure>
<img
src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp"
alt="Shoes" />
</figure>
<div class="$$card-body">
<h2 class="$$card-title">Card Title</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
가격 카드 (Pricing Card)
<div class="$$card w-96 bg-base-100 shadow-sm">
<div class="$$card-body">
<span class="$$badge $$badge-xs $$badge-warning">Most Popular</span>
<div class="flex justify-between">
<h2 class="text-3xl font-bold">Premium</h2>
<span class="text-xl">$29/mo</span>
</div>
<ul class="mt-6 flex flex-col gap-2 text-xs">
<li>
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 me-2 inline-block text-success" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span>High-resolution image generation</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 me-2 inline-block text-success" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span>Customizable style templates</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 me-2 inline-block text-success" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span>Batch processing capabilities</span>
</li>
<li>
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 me-2 inline-block text-success" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span>AI-driven image enhancements</span>
</li>
<li class="opacity-50">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 me-2 inline-block text-base-content/50" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span class="line-through">Seamless cloud integration</span>
</li>
<li class="opacity-50">
<svg xmlns="http://www.w3.org/2000/svg" class="size-4 me-2 inline-block text-base-content/50" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
<span class="line-through">Real-time collaboration tools</span>
</li>
</ul>
<div class="mt-6">
<button class="$$btn $$btn-primary $$btn-block">Subscribe</button>
</div>
</div>
</div>
Card 크기 (Sizes)
<div class="$$card w-96 bg-base-100 $$card-xs shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Xsmall Card</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="justify-end $$card-actions">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
<div class="$$card w-96 bg-base-100 $$card-sm shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Small Card</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="justify-end $$card-actions">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
<div class="$$card w-96 bg-base-100 $$card-md shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Medium Card</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="justify-end $$card-actions">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
<div class="$$card w-96 bg-base-100 $$card-lg shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Large Card</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="justify-end $$card-actions">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
<div class="$$card w-96 bg-base-100 $$card-xl shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Xlarge Card</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="justify-end $$card-actions">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
card-border가 있는 Card
<div class="$$card $$card-border bg-base-100 w-96">
<div class="$$card-body">
<h2 class="$$card-title">Card Title</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
dash 테두리가 있는 Card
<div class="$$card $$card-dash bg-base-100 w-96">
<div class="$$card-body">
<h2 class="$$card-title">Card Title</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
배지가 있는 Card
<div class="$$card bg-base-100 w-96 shadow-sm">
<figure>
<img
src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp"
alt="Shoes" />
</figure>
<div class="$$card-body">
<h2 class="$$card-title">
Card Title
<div class="$$badge $$badge-secondary">NEW</div>
</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<div class="$$badge $$badge-outline">Fashion</div>
<div class="$$badge $$badge-outline">Products</div>
</div>
</div>
</div>
이미지가 아래 있는 Card
<div class="$$card bg-base-100 w-96 shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Card Title</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
</div>
<figure>
<img
src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp"
alt="Shoes" />
</figure>
</div>
콘텐츠 중앙 정렬과 패딩이 있는 Card
<div class="$$card bg-base-100 w-96 shadow-sm">
<figure class="px-10 pt-10">
<img
src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp"
alt="Shoes"
class="rounded-xl" />
</figure>
<div class="$$card-body items-center text-center">
<h2 class="$$card-title">Card Title</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
이미지 오버레이가 있는 Card
<div class="$$card bg-base-100 $$image-full w-96 shadow-sm">
<figure>
<img
src="https://img.daisyui.com/images/stock/photo-1606107557195-0e29a4b5b4aa.webp"
alt="Shoes" />
</figure>
<div class="$$card-body">
<h2 class="$$card-title">Card Title</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
이미지 없는 Card
<div class="$$card bg-base-100 w-96 shadow-sm">
<div class="$$card-body">
<h2 class="$$card-title">Card title!</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Buy Now</button>
</div>
</div>
</div>
custom 색상 Card
<div class="$$card bg-primary text-primary-content w-96">
<div class="$$card-body">
<h2 class="$$card-title">Card title!</h2>
<p>A card component has a figure, a body part, and inside body there are title and actions parts</p>
<div class="$$card-actions justify-end">
<button class="$$btn">Buy Now</button>
</div>
</div>
</div>
neutral 색상 중앙 정렬 Card
<div class="$$card bg-neutral text-neutral-content w-96">
<div class="$$card-body items-center text-center">
<h2 class="$$card-title">Cookies!</h2>
<p>We are using cookies for no reason.</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Accept</button>
<button class="$$btn $$btn-ghost">Deny</button>
</div>
</div>
</div>
위에 액션이 있는 Card
<div class="$$card bg-base-100 w-96 shadow-sm">
<div class="$$card-body">
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-square $$btn-sm">
<svg
aria-label="Close"
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor">
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<p>We are using cookies for no reason.</p>
</div>
</div>
이미지가 옆에 있는 Card
<div class="$$card $$card-side bg-base-100 shadow-sm">
<figure>
<img
src="https://img.daisyui.com/images/stock/photo-1635805737707-575885ab0820.webp"
alt="Movie" />
</figure>
<div class="$$card-body">
<h2 class="$$card-title">New movie is released!</h2>
<p>Click the button to watch on Jetflix app.</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Watch</button>
</div>
</div>
</div>
반응형 Card (작은 화면엔 세로, 큰 화면엔 가로)
<div class="$$card lg:$$card-side bg-base-100 shadow-sm">
<figure>
<img
src="https://img.daisyui.com/images/stock/photo-1494232410401-ad00d5433cfa.webp"
alt="Album" />
</figure>
<div class="$$card-body">
<h2 class="$$card-title">New album is released!</h2>
<p>Click the button to listen on Spotiwhy app.</p>
<div class="$$card-actions justify-end">
<button class="$$btn $$btn-primary">Listen</button>
</div>
</div>
</div>
선택 가능한 카드
<div class="flex flex-wrap items-start gap-3">
<label class="$$card bg-accent text-accent-content">
<input type="checkbox" name="card-urgent-1" />
<div class="$$card-body">
<h2 class="$$card-title">Urgent</h2>
<p>Same day delivery</p>
</div>
</label>
<div class="$$join bg-base-300 rounded-selector">
<label class="$$join-item $$card">
<input type="radio" value="sm" name="card-size-1" />
<div class="$$card-body">
<h2 class="$$card-title">Size SM</h2>
<p>Available</p>
</div>
</label>
<label class="$$join-item $$card">
<input type="radio" value="md" name="card-size-1" disabled />
<div class="$$card-body opacity-60">
<h2 class="$$card-title">Size MD</h2>
<p>Not available</p>
</div>
</label>
<label class="$$join-item $$card">
<input type="radio" value="lg" name="card-size-1" />
<div class="$$card-body">
<h2 class="$$card-title">Size LG</h2>
<p>Short supply</p>
</div>
</label>
</div>
</div>
더 알아보기 (Learn more)
daisyUI의 Card 컴포넌트와 card-title·card-body·card-actions 파트, 크기·색상, 이미지 배치(card-side, image-full), 그리고 선택 가능한 카드 활용법에 대해 더 알아보세요.