Blog Card Three
shadcn-extras/blog-card-threeFreeComponent
Minimal blog card with small rounded thumbnail and meta. Variants: thumbnail left or right.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/NayanDevLab/shadcn-extras/dev/public/c/blog-card-three.jsonSource
1'use client';23import * as React from 'react';4import Link from 'next/link';5import { ThumbsUp, Bookmark } from 'lucide-react';6import { cn } from '@/lib/utils';78export type BlogCardThreeMeta = {9 author?: { name: string; avatar?: string; href?: string };10 readLabel?: string; // "2 min read"11};1213export type BlogCardThreeProps = {14 /** Whole card link */15 href?: string;1617 /** Title */18 title: string;1920 /** Small square thumbnail */21 thumb?: { src: string; alt?: string };2223 /** Meta row */24 meta?: BlogCardThreeMeta;2526 /** Actions */27 onLike?: () => void;28 onBookmark?: () => void;2930 /** Layout */31 variant?: 'thumb-right' | 'thumb-left';3233 /** Slot overrides */34 className?: string;35 titleClassName?: string;36 thumbClassName?: string;37 metaClassName?: string;38 actionsClassName?: string;39};4041export function BlogCardThree({42 href,43 title,44 thumb,45 meta,46 onLike,47 onBookmark,48 variant = 'thumb-right',49 className,50 titleClassName,51 thumbClassName,52 metaClassName,53 actionsClassName,54}: BlogCardThreeProps) {55 const Wrapper: any = href ? Link : 'article';56 const wrapperProps = href57 ? { href, 'aria-label': title }58 : { role: 'article' };5960 const Thumb = (61 <div62 className={cn(63 'relative h-20 w-20 shrink-0 overflow-hidden rounded-xl ring-1 ring-black/5 dark:ring-white/10',64 thumbClassName65 )}66 >67 {/* eslint-disable-next-line @next/next/no-img-element */}68 {thumb?.src ? (69 <img70 src={thumb.src}71 alt={thumb.alt ?? ''}72 className='h-full w-full object-cover'73 loading='lazy'74 />75 ) : (76 <div className='grid h-full w-full place-items-center bg-zinc-100 text-xs text-zinc-400 dark:bg-zinc-800'>77 no image78 </div>79 )}80 </div>81 );8283 return (84 <Wrapper85 {...(wrapperProps as any)}86 className={cn(87 'group flex items-start gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm transition-shadow hover:shadow-md dark:border-zinc-800 dark:bg-zinc-900',88 'focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500',89 className90 )}91 >92 {/* optional left thumb */}93 {variant === 'thumb-left' && Thumb}9495 <div className='flex min-w-0 flex-1 flex-col gap-6'>96 {/* title */}97 <h398 className={cn(99 'line-clamp-2 text-[17px] leading-snug font-semibold text-zinc-900 group-hover:underline dark:text-zinc-50',100// … 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 Fourblog-card-four | shadcn-extras | Components | Free | 1 dep | |
| Blog Card Oneblog-card-one | shadcn-extras | Components | Free | no deps | |
| 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 |
