Blog Card Four
shadcn-extras/blog-card-fourFreeComponent
Top rounded cover image with an attached white info panel. Variants: attached or flush.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/NayanDevLab/shadcn-extras/dev/public/c/blog-card-four.jsonSource
1'use client';23import * as React from 'react';4import Link from 'next/link';5import { CalendarDays } from 'lucide-react';6import { cn } from '@/lib/utils';78export type BlogCardFourProps = {9 /** Entire card link; if omitted renders as plain <article>. */10 href?: string;1112 /** Cover image (top, rounded). */13 image: { src: string; alt?: string };1415 /** Title and short description. */16 title: string;17 excerpt?: string;1819 /** Footer meta. */20 author?: { name: string; avatar?: string; href?: string };21 dateISO?: string;22 dateLabel?: string;2324 /** Visual tweaks */25 className?: string;26 imageClassName?: string;27 panelClassName?: string;28 titleClassName?: string;29 excerptClassName?: string;30 footerClassName?: string;3132 /**33 * Layout variant:34 * - "attached": white panel slightly overlaps the image (screenshot look)35 * - "flush": panel sits directly under the image with no offset36 */37 variant?: 'attached' | 'flush';38};3940export function BlogCardFour({41 href,42 image,43 title,44 excerpt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi necessitatibus repellat voluptatibus?',45 author,46 dateISO,47 dateLabel,48 className,49 imageClassName,50 panelClassName,51 titleClassName,52 excerptClassName,53 footerClassName,54 variant = 'attached',55}: BlogCardFourProps) {56 const Wrapper: any = href ? Link : 'article';57 const wrapperProps = href58 ? { href, 'aria-label': title }59 : { role: 'article' };6061 return (62 <Wrapper63 {...(wrapperProps as any)}64 className={cn(65 'group block w-full max-w-sm',66 'focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500',67 className68 )}69 >70 {/* Top cover image */}71 <div className='relative'>72 {/* eslint-disable-next-line @next/next/no-img-element */}73 <img74 src={image.src}75 alt={image.alt ?? ''}76 loading='lazy'77 className={cn(78 'h-44 w-full rounded-3xl object-cover',79 'ring-1 ring-black/5 dark:ring-white/10',80 imageClassName81 )}82 />83 </div>8485 {/* Info panel */}86 <div87 className={cn(88 'relative -mt-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm transition-shadow dark:border-zinc-800 dark:bg-zinc-900',89 variant === 'flush' && 'mt-2',90 panelClassName91 )}92 >93 <h394 className={cn(95// … truncated
What it pulls in
npm packages
Files it writes
More from shadcn-extras
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Image Gridanimated-image-grid | shadcn-extras | Components | Free | no deps · 3 files | |
| Blog Card Oneblog-card-one | shadcn-extras | Components | Free | no deps | |
| Blog Card Threeblog-card-three | shadcn-extras | Components | Free | 1 dep | |
| Blog Card Twoblog-card-two | shadcn-extras | Components | Free | 1 dep | |
| Bulb Iconbulb-icon | shadcn-extras | Components | Free | 2 deps | |
| Chevron Stepschevron-steps | shadcn-extras | Components | Free | no deps | |
| Circular Gallerycircular-gallery | shadcn-extras | Components | Free | no deps · 3 files | |
| Clock Iconclock-icon | shadcn-extras | Components | Free | 2 deps |
