ImageCard
A polaroid-style image display card: the image area locks its geometry with a fixed aspect ratio, while the label footer renders as a solid theme-colored band separated by a thick black rule. The whole card lifts on hover with a hard, blur-free shadow, following the library's unified interaction language.
Preview
基础拍立得相框
悬浮时整卡上浮,投影保持硬边无模糊。
宽高比与底栏色族
自定义底栏插槽
Installation
pnpm dlx brutx-vue@latest add image-cardUsage
Basic Usage
<script setup>
import { ImageCard } from 'brutx-ui-vue'
</script>
<template>
<ImageCard
class="max-w-xs"
src="/images/field-record.jpg"
alt="Field record photo"
title="Field Record 001"
description="The whole card lifts on hover with a hard shadow."
/>
</template>Aspect Ratio & Footer Accent
aspect locks the image geometry; accent picks the footer color family.
<template>
<ImageCard
src="/images/archive.jpg"
alt="Archived material"
aspect="square"
accent="destructive"
title="Aspect Square"
/>
</template>Custom Footer Slot
The default slot replaces the title/description structure for free-form footer content.
<template>
<ImageCard src="/images/archive.jpg" alt="Archived material">
<div class="flex items-center justify-between font-mono text-xs font-bold uppercase">
<span>Archive / 1998</span>
<span>[ CONFIDENTIAL ]</span>
</div>
</ImageCard>
</template>API Reference
| Name | Type | Default | Description |
|---|---|---|---|
srcRequired | string | — | The resource URL used by the image element. |
DetailsDeclared typestring Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
alt | string | undefined | "" | Alternative text for the image; an empty string marks it as decorative. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
aspect | ImageCardAspect | undefined | undefined | Sets the image area ratio: video is 16:9, square is 1:1, and 4/3 is 4:3. |
DetailsDeclared typeImageCardAspect | undefined Literal values
Referenced types ImageCardAspect Type definition — ImageCardAspecttype ImageCardAspect = '4/3' | 'video' | 'square' Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
accent | ImageCardAccent | undefined | undefined | Sets the theme color family used by the footer. |
DetailsDeclared typeImageCardAccent | undefined Literal values
Referenced types ImageCardAccent Type definition — ImageCardAccenttype ImageCardAccent = 'primary' | 'secondary' | 'accent' | 'destructive' | 'success' | 'info' | 'muted' Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
title | string | undefined | undefined | The title text displayed in the footer. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
description | string | undefined | undefined | The description text displayed alongside the footer title. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
classNullable | ClassValue | undefined | Custom CSS class values added to the image card root element. |
DetailsDeclared typeClassValue Literal values
Default value details
Sourcepackages/ui/src/components/image-card/ImageCard.vue | |||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Replaces the default footer content. When title, description, and slot content are all absent, the footer is omitted and only the image is shown. |
DetailsDeclared type{}Sourcepackages/ui/src/components/image-card/ImageCard.vue | ||
Frameless-footer mode
When neither title nor description is provided and no default slot content exists, <figcaption> is skipped and the component degrades to a pure framed image.
Accessibility
- Alternative text: informative images must provide
alt; pass an empty string for purely decorative images so screen readers skip them. - Semantic structure: the root is a
<figure>and the footer a<figcaption>, preserving native image/caption semantics. - Motion degradation: the hover lift transition is the only animation and follows the global reduced-motion policy.