惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
腾讯CDC
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
Engineering at Meta
Engineering at Meta
C
Check Point Blog
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
WordPress大学
WordPress大学
博客园 - 司徒正美

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Why I Built Cartlify — A Production-Ready E-commerce UI K...
Karthik Gs · 2026-06-06 · via DEV Community

Karthik Gs

After 10+ years of rebuilding the same components, I finally packaged them.


The Problem

Every e-commerce project I've worked on — at Fidelity Investments, OCBC Bank, Mondi Group — started the same way.

Day 1: Build the ProductCard.
Day 2: Build the CartDrawer.
Day 3: Wire up the CheckoutStepper.
Day 4: Fix accessibility issues.
Day 5: Write tests.

And then repeat on the next project.

After doing this enough times, I realized: this is wasted time. These components don't change much between projects. The logic is always the same. The accessibility requirements are always the same. The edge cases are always the same.

So I built Cartlify — a React + TypeScript + Tailwind CSS component library specifically for e-commerce UIs.


What's Inside

🛍️ ProductCard

The component every e-commerce app needs on day one.

  • 3 layout variants — default (vertical), horizontal, compact
  • Image gallery with thumbnail navigation
  • Wishlist toggle (filled/outline heart)
  • Sale / New / Out of Stock badges
  • Star ratings display
  • Skeleton loading state with animate-pulse
  • Automatic discount % calculation from originalPrice
<ProductCard
  product={product}
  variant="default"
  showRating={true}
  showWishlist={true}
  onAddToCart={(p) => addToCart(p)}
  onWishlistToggle={(p) => toggleWishlist(p)}
/>


🛒 CartDrawer

A slide-in cart drawer that handles everything out of the box.

  • Smooth slide-in from right (or left)
  • Focus trap — keyboard stays inside the drawer when open
  • ESC key dismisses the drawer
  • Quantity stepper with min/max controls
  • Empty cart state with custom icon support
  • Auto-calculated subtotal
  • Fixed header + scrollable items + fixed footer
const { isOpen, onOpen, onClose } = useDisclosure();

<CartDrawer
  isOpen={isOpen}
  onClose={onClose}
  items={cartItems}
  onQuantityChange={handleQuantityChange}
  onRemoveItem={handleRemove}
  onCheckout={handleCheckout}
/>


✅ CheckoutStepper

Multi-step progress indicator for the checkout flow.

  • Horizontal and vertical orientations
  • Animated connector lines between steps
  • Three step states: completed, active, pending
  • Click on completed steps to go back
  • Custom icons per step
  • Keyboard navigation (arrow keys)
<CheckoutStepper
  steps={[
    { id: 'cart', label: 'Cart' },
    { id: 'shipping', label: 'Shipping' },
    { id: 'payment', label: 'Payment' },
    { id: 'confirm', label: 'Confirm' },
  ]}
  currentStep={2}
  orientation="horizontal"
  onStepClick={(index) => setStep(index)}
/>


⏳ PageLoader

4 animation styles (spin, pulse, bounce, dots) with 3 position modes (inline, overlay, fullscreen).


What Else Ships With It

Beyond the 4 components, Cartlify includes:

  • 3 utility hooksuseCart, useDisclosure, useMediaQuery
  • 11 tree-shakeable icons — cart, heart, star, trash, chevrons, and more
  • 40+ CSS design tokens — spacing, colors, radii, shadows
  • Full dark mode support out of the box
  • Reusable primitives — Button, Badge, IconButton used internally

Built for Real Production Use

I didn't want this to be a demo library. Every decision was made with production in mind:

Testing

141 Jest + React Testing Library tests covering interactions, accessibility, edge cases, and keyboard behavior.

PASS src/components/CartDrawer/CartDrawer.test.tsx
PASS src/components/ProductCard/ProductCard.test.tsx
PASS src/components/CheckoutStepper/CheckoutStepper.test.tsx
Test Suites: 12 passed
Tests: 141 passed

Accessibility

Every component is WCAG 2.1 AA compliant:

  • aria-modal, role="dialog" on CartDrawer
  • aria-current="step" on active stepper step
  • role="article" on ProductCard
  • All icon buttons have aria-label
  • Full keyboard navigation

TypeScript

Strict mode, zero any. Every prop is typed, every event handler is typed.

interface ProductCardProps {
  product: Product;
  variant?: 'default' | 'horizontal' | 'compact';
  showRating?: boolean;
  isWishlisted?: boolean;
  onAddToCart: (product: Product) => void;
  onWishlistToggle?: (product: Product) => void;
}

Bundler Compatibility

Works with Vite, Next.js, Remix — any modern bundler. Ships as ESM + CJS with .d.ts types via tsup.


Tech Stack

Layer Choice
Framework React 18
Language TypeScript (strict)
Styling Tailwind CSS v3
Documentation Storybook v7
Testing Jest + React Testing Library
Build tsup
Linting ESLint + Prettier

Folder Structure

src/
├── components/
│   ├── ProductCard/
│   ├── CartDrawer/
│   ├── CheckoutStepper/
│   └── PageLoader/
├── primitives/
│   ├── Button/
│   ├── Badge/
│   └── IconButton/
├── hooks/
│   ├── useCart.ts
│   ├── useDisclosure.ts
│   └── useMediaQuery.ts
├── icons/
├── tokens/
└── types/

Clean path aliases so no ../../ imports anywhere:

import { Button } from '@primitives/Button';
import { useCart } from '@hooks/useCart';
import type { Product } from '@types';


Storybook Documentation

Every component has full interactive Storybook stories covering all variants, states, and edge cases. You can explore the live Storybook before buying.

Live demo → https://cartlify.vercel.app/


Get It

Cartlify is available on Gumroad for $29 — one-time payment, single-site license.

🛒 Gumroad → https://karthiksoftengg.gumroad.com/l/cartlify-react-ui-kit


What's Next

Planning to add:

  • ProductGrid with filter sidebar
  • SearchBar with suggestions
  • ReviewCard + RatingInput
  • WishlistDrawer
  • More design token themes

If there's a component you'd love to see, drop it in the comments — I'll prioritize based on demand.


Built by Karthik G S — Senior Frontend Engineer with 10+ years experience in React, TypeScript and React Native.


Tags: react typescript tailwindcss storybook webdev javascript frontend ecommerce opensource