Just shipped our new zero-dependency UI component library! Built with pure semantic HTML5 & native CSS custom properties. Sub-10ms render latency, 0 kB runtime JS bloat.
#WebDev #UIComponents #React #OpenSource
Social post card for testimonials, with a verified badge, engagement counts, media embed and light or dark themes.
The Tweet Card is an engineered, accessible social proof card that displays user feedback, developer tweets, or product reviews with zero client-side iframe overhead. Unlike the official X embed, which loads a third-party script and iframe, this component is plain HTML and CSS that you control, so it adds no tracking and no extra network requests.
Engineered with semantic <article> tags, accessible SVG iconography for verified checkmarks, and responsive CSS variables. It includes dynamic engagement counters (replies, retweets, likes, bookmarks) with optimistic state updates and keyboard-navigable interaction triggers.
Standalone, dependency-free implementation. Drop directly into your project.
import React, { useState } from 'react';
export interface TweetAuthor {
name: string;
handle: string;
avatar: string;
verified?: boolean;
}
export interface TweetMetrics {
replies: number;
retweets: number;
likes: number;
views?: string;
}
export interface TweetCardProps {
author: TweetAuthor;
content: string;
date: string;
metrics?: TweetMetrics;
mediaUrl?: string;
className?: string;
}
export const TweetCard: React.FC<TweetCardProps> = ({
author,
content,
date,
metrics = { replies: 12, retweets: 34, likes: 256, views: '14.5K' },
mediaUrl,
className = '',
}) => {
const [likes, setLikes] = useState(metrics.likes);
const [liked, setLiked] = useState(false);
const [bookmarked, setBookmarked] = useState(false);
const toggleLike = () => {
setLiked(!liked);
setLikes(prev => (liked ? prev - 1 : prev + 1));
};
return (
<article
className={`tweet-card ${className}`}
aria-label={`Tweet by ${author.name} (@${author.handle})`}
>
<header className="tweet-card-header">
<img
src={author.avatar}
alt={author.name}
className="tweet-card-avatar"
width={44}
height={44}
loading="lazy"
/>
<div className="tweet-card-meta">
<div className="tweet-card-author-row">
<span className="tweet-card-name">{author.name}</span>
{author.verified && (
<svg className="tweet-card-badge" viewBox="0 0 24 24" fill="#1d9bf0" width="18" height="18" aria-label="Verified account">
<path d="M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.79-4-4-4-.495 0-.965.084-1.4.238C14.45 2.475 13.08 1.6 11.5 1.6s-2.95.875-3.6 2.148c-.435-.154-.905-.238-1.4-.238-2.21 0-4 1.79-4 4 0 .495.084.965.238 1.4C1.475 9.55.6 10.92.6 12.5s.875 2.95 2.148 3.6c-.154.435-.238.905-.238 1.4 0 2.21 1.79 4 4 4 .495 0 .965-.084 1.4-.238 1.14 1.273 2.51 2.148 4.09 2.148s2.95-.875 3.6-2.148c.435.154.905.238 1.4.238 2.21 0 4-1.79 4-4 0-.495-.084-.965-.238-1.4 1.273-1.14 2.148-2.51 2.148-4.09zm-12.2 4.4l-3.9-3.9 1.4-1.4 2.5 2.5 6.5-6.5 1.4 1.4-7.9 7.9z"/>
</svg>
)}
</div>
<span className="tweet-card-handle">@{author.handle} · {date}</span>
</div>
</header>
<div className="tweet-card-body">
<p>{content}</p>
</div>
{mediaUrl && (
<div className="tweet-card-media">
<img src={mediaUrl} alt="Embedded tweet media" loading="lazy" />
</div>
)}
<footer className="tweet-card-actions">
<button type="button" className="tweet-action-btn" aria-label="Reply">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
<span>{metrics.replies}</span>
</button>
<button type="button" className="tweet-action-btn" aria-label="Retweet">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
<span>{metrics.retweets}</span>
</button>
<button
type="button"
onClick={toggleLike}
className={`tweet-action-btn ${liked ? 'tweet-liked' : ''}`}
aria-label={liked ? 'Unlike tweet' : 'Like tweet'}
>
<svg width="18" height="18" viewBox="0 0 24 24" fill={liked ? '#e11d48' : 'none'} stroke={liked ? '#e11d48' : 'currentColor'} strokeWidth="2">
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
<span>{likes}</span>
</button>
<button
type="button"
onClick={() => setBookmarked(!bookmarked)}
className={`tweet-action-btn ${bookmarked ? 'tweet-bookmarked' : ''}`}
aria-label={bookmarked ? 'Remove bookmark' : 'Bookmark tweet'}
>
<svg width="18" height="18" viewBox="0 0 24 24" fill={bookmarked ? '#2563eb' : 'none'} stroke={bookmarked ? '#2563eb' : 'currentColor'} strokeWidth="2">
<path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/>
</svg>
</button>
</footer>
</article>
);
};.tweet-card {
max-width: 480px;
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 16px;
padding: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
font-family: var(--font-body, -apple-system, sans-serif);
}
.tweet-card-header {
display: flex;
align-items: center;
gap: 12px;
}
.tweet-card-avatar {
border-radius: 50%;
object-fit: cover;
}
.tweet-card-author-row {
display: flex;
align-items: center;
gap: 6px;
}
.tweet-card-name {
font-weight: 700;
font-size: 15px;
color: #0f172a;
}
.tweet-card-handle {
font-size: 13px;
color: #64748b;
}
.tweet-card-body {
margin: 14px 0 16px;
font-size: 14.5px;
line-height: 1.6;
color: #334155;
}
.tweet-card-actions {
display: flex;
justify-content: space-between;
border-top: 1px solid #f1f5f9;
padding-top: 12px;
}
.tweet-action-btn {
background: none;
border: none;
display: flex;
align-items: center;
gap: 6px;
color: #64748b;
cursor: pointer;
font-size: 13px;
transition: color 0.15s ease;
}
.tweet-action-btn:hover { color: #0284c7; }
.tweet-liked { color: #e11d48 !important; }
.tweet-bookmarked { color: #2563eb !important; }<!-- Tailwind CSS Variant -->
<article class="max-w-md rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm transition hover:border-neutral-300 dark:border-neutral-800 dark:bg-neutral-950">
<div class="flex items-center gap-3">
<img src="/avatar.jpg" class="h-11 w-11 rounded-full object-cover" alt="User Avatar" />
<div>
<div class="flex items-center gap-1.5 font-semibold text-neutral-900 dark:text-white">
<span>Alex Rivera</span>
<svg class="h-4 w-4 fill-sky-500" viewBox="0 0 24 24">...</svg>
</div>
<p class="text-xs text-neutral-500">@alexrivera · Oct 4</p>
</div>
</div>
<p class="mt-3.5 text-sm leading-relaxed text-neutral-700 dark:text-neutral-300">
Clean, readable UI components I can copy straight into my project.
</p>
<div class="mt-4 flex items-center justify-between border-t border-neutral-100 pt-3 text-xs text-neutral-500 dark:border-neutral-800">
<button class="flex items-center gap-1.5 hover:text-sky-500">...</button>
<button class="flex items-center gap-1.5 hover:text-emerald-500">...</button>
<button class="flex items-center gap-1.5 hover:text-rose-500">...</button>
</div>
</article>Steps to add this component to Next.js (App Router), Vite, or Astro projects.
No heavy runtime dependencies are required. Pure SVG icons are built-in.
npm install lucide-react # optional, pure SVGs included belowimport { TweetCard } from '@/components/TweetCard';
<TweetCard
author={{
name: "Sarah Chen",
handle: "sarahdev",
avatar: "https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=100&h=100&fit=crop",
verified: true,
}}
content="Just shipped our new real-time AI analytics engine with zero-dependency CSS. Sub-10ms latency across the globe!"
date="Oct 4, 2026"
metrics={{ replies: 42, retweets: 128, likes: 890, views: "45.2K" }}
/>TypeScript interfaces, default values, and runtime behavior.
| Prop | Type | Default | Description |
|---|---|---|---|
| author | AuthorObject | Required | Author name, handle, avatar URL, and verified status flag. |
| content | string | Required | Text body of the tweet including hashtags and mentions. |
| date | string | Required | Timestamp string (e.g. "Oct 4, 2026"). |
| metrics | MetricsObject | Optional | Initial counts for replies, retweets, likes, and impressions. |
| mediaUrl | string | undefined | Optional media image URL embedded inside the card. |
| className | string | '' | Optional custom CSS class name for outer card styling. |
Use Next.js Image or native loading="lazy" for avatars and embedded media to eliminate render blocking. These are design notes, not measurements: check your own page with Lighthouse or PageSpeed Insights.
Asymmetric feature showcase grid with ambient radial spotlight, badge headers, and interactive hover states.
Inspect Component Animations & FeedsDynamic notification and activity feed with staggered entrance transitions, auto-flow, and pause controls.
Inspect Component Navigation & ToolbarsmacOS-inspired floating navigation bar with proximity-based icon magnification and dark glassmorphism.
Inspect ComponentThese components are written as plain React and CSS so you can read, copy and change every line. Several are adapted from the open-source Magic UI and UI-Layouts libraries, which are credited on each page. Test them in your own layout, with your own content, before you ship.