CartBadge

Domain

Round cart button for the header that shows the number of items in the cart. Counts above 99 render as a "99+" badge.

States

Preview
Empty
3 items
12 items
99+ overflow
Code
<%- include('modules/domain/common/cart/CartBadge', {
  cart: { items: [] }
}) %>
<%- include('modules/domain/common/cart/CartBadge', {
  cart: { items: [{ quantity: 1 }, { quantity: 2 }] }
}) %>
<%- include('modules/domain/common/cart/CartBadge', {
  cart: { items: [{ quantity: 150 }] }
}) %>

In a header

Preview
S Shop
Code
Shop
Source modules/domain/common/cart/CartBadge.ejs