GitHub

Media Card

Block
Card with image handling, fallbacks, and layout options

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { MediaCard } from "@corew500/ui/blocks/media-card"

<MediaCard>Content</MediaCard>

Horizontal

Loading...

CMS Integration

CMSPayload CMS Integration
This component supports CMS-driven content via @corew500/cms-payload.
Loading...

API Reference

Props

PropTypeDefaultDescription
title*stringCard title (required)
descriptionstringCard description/excerpt
image{ src: string; alt: string; }Image source
imageSlotenumCustom image slot for framework-specific images (e.g., Next.js Image). Takes precedence over `image` prop.
fallbackIconenumFallback icon to show when image fails to load or is not provided.
aspectRationumber16 / 9Image aspect ratio.
layoutenumverticalLayout variant. - `vertical`: Image above content (default) - `horizontal`: Image beside content
imageHoverenumzoomImage hover effect. - `none`: No effect - `zoom`: Scale up image on hover - `brightness`: Brighten image on hover
descriptionLinesenum3Max lines for description (line-clamp).
metadataMediaCardMetadata[]Metadata items (displayed as a row with icons)
actionMediaCardActionPrimary action button
secondaryActionMediaCardActionSecondary action button
badgeenumOptional badge (ReactNode) displayed over the image

Accessibility

Additional

  • - Image requires alt text via `image.alt` or `imageSlot` props
  • Card structure uses semantic heading hierarchy (CardTitle)
  • Action buttons have accessible labels

Localization

Translatable Content

  • - Component accepts pre-resolved translated strings
  • All text customizable: title, description, metadata.text, action.label

Related

Related Components