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*string—Card title (required)
descriptionstring—Card description/excerpt
image{ src: string; alt: string; }—Image source
imageSlotenum—Custom image slot for framework-specific images (e.g., Next.js Image). Takes precedence over `image` prop.
fallbackIconenum—Fallback 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)
actionMediaCardAction—Primary action button
secondaryActionMediaCardAction—Secondary action button
badgeenum—Optional 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