Skip to content

Product page in React

A complete product page: product views, colors and sizes as radio buttons, a quantity selector and an announced add-to-cart.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

ProductPage.tsx
import { useState, type CSSProperties, type FormEvent } from "react";

const glazes = [
  { name: "Sauge", from: "#c9d6bd", to: "#6f8a5e" },
  { name: "Sable", from: "#efe1c6", to: "#b08d5c" },
  { name: "Nuit", from: "#7c8aa8", to: "#1f2a44" },
];
const sizes = [
  { label: "25 cl", price: 32 },
  { label: "35 cl", price: 36 },
];
const views = [

Free component: copy it freely, including for commercial projects.

E-commerce components in React
  • A limited-time offer bar: countdown to a fixed date, one-click copyable promo code and a fallback message once the offer is over.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A sales card showing the discount that grows with the cart amount (-10% from €50, -15% from €100…) with a progress bar towards the next tier.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A Christmas gift guide filtered by budget and theme, with the number of ideas announced and an empty state offering to show everything again.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • The last order dates for delivery before Christmas, per shipping method, with the days left worked out from the visitor’s date.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A cart that shows live how much is left to add for free shipping, with a progress bar and recalculated totals.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A colour and size picker for a product page: the visual, price and stock follow the choice, and sold-out sizes are disabled.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component