Skip to content

Order History

Tailwind CSS order history list with status filter chips, colored status badges and expandable order details.

Also known as: order history list, my orders page, purchase history, order tracking list, customer orders

Order History live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

An order history list for customer account pages, built with Tailwind CSS and a few lines of vanilla JavaScript. Each order shows its number, date, item count, a colored status badge and the total, and expands to reveal the purchased items with a context-specific action such as Track package, Return or Buy again. Filter chips at the top narrow the list by status.

How it works

The root is .toh-history. Orders are li elements inside a labelled list; each one carries data-toh-status (processing, shipped, delivered or cancelled) and a matching colored left border. Inside, an article holds a responsive grid: on phones the order number spans the full width with the badge and total below and a full-width toggle button; from sm up everything sits on one row using sm:grid-cols-[1fr_auto_auto_auto].

Every toggle is marked data-toh-toggle and points to its .toh-panel with aria-controls. On click the script flips aria-expanded, toggles the panel's hidden attribute and swaps the data-toh-toggle-label text between "View items" and "Hide items". In style.css, .toh-chevron rotates 180 degrees when its button is expanded and .toh-panel fades in with the toh-reveal keyframes.

The filter chips are buttons with data-toh-filter and aria-pressed. Choosing one hides orders whose status does not match, updates the pressed state (styled with Tailwind's aria-pressed: variant), refreshes the data-toh-count text and shows the data-toh-empty message when nothing matches. Adding data-toh-open to an order li expands it on page load.

Customization

  • data-toh-status on each li: add a new value such as returned, then add a chip with data-toh-filter="returned" to filter by it.
  • data-toh-open on an order li: remove it from the shipped order to start with every order collapsed, or add it to others.
  • border-l-4 border-sky-500 on an order: change the stripe color or drop border-l-4 for a plain card.
  • bg-sky-100 text-sky-800 on a badge: recolor a status; keep the dot (bg-sky-500) in the same hue.
  • aria-pressed:bg-slate-900 aria-pressed:text-white on the chips: change the selected chip style.
  • animation: toh-reveal 0.22s in style.css: tune or remove the panel entrance.
  • max-w-3xl on the section: widen it for a full account dashboard.

Use cases

  • Customer accounts: list orders with number, date, item count, status badge and total
  • Online shops: filter chips narrow orders by status
  • Order details: expand a row to see purchased items
  • Post-purchase actions: buttons such as Track package, Return or Buy again fit each status

Accessibility

Each order is an article labelled by its h3, and dates use time elements with machine-readable datetime values. Toggle buttons expose aria-expanded and aria-controls, and a visually hidden suffix (for example "for order WD-10482") gives every button a unique name. Filter chips sit in a role="group" with an aria-label and report their state through aria-pressed; the result count is a polite role="status" region. The cancelled total is struck through visually and prefixed with a hidden "Refunded" label. All controls are native buttons with visible focus outlines, and the chevron and panel animations are disabled under prefers-reduced-motion.

Usage notes

Panel IDs (toh-o1-panel and so on) must be unique on the page; prefix them when rendering several lists. Wire the action buttons to your own routes.

Order History at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Order History
License
Free for personal and commercial use

Questions about this template

Can I use the Order History code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Order History – free Tailwind CSS order history template
Order History · free Tailwind CSS order history template

More Order History

Order Details Page with Product Photos – free Bootstrap 5 order history template

Order Details Page with Product Photos

Bootstrap 5 order details page with product photos, delivery progress tracker, price summary, shipping address, copy order number and buy-again toast.

Printable Invoice Layout – free Tailwind CSS order history template

Printable Invoice Layout

Tailwind CSS invoice with line items, auto-calculated discount, tax and balance due, a print button and print-friendly A4 styles.