Skip to content

os-product-list (Product List)

os-product-list loads available collections and renders a filterable list of products using os-single-product cards.

os-product-list (Product List)

nametyperequireddefaultdescription
product-url-prefixstringNoNoneproduct-url-prefix="/products" — Prefix used to build product page URLs for child os-single-product cards.
searchstringNoNonesearch="true" — Renders the search field above the grid. Must be exactly "true"; any other value (or omitting the attribute) hides it.
search-scope"all" | "collection"Noallsearch-scope="collection" — Controls how the search field and the collection chips interact. all always searches every product; collection searches inside the selected collection. An unrecognized value logs a console warning and falls back to all. See the search behavior note below.
collections-orientation"horizontal" | "vertical"Nohorizontalcollections-orientation="vertical" — Lays the collection filter chips out in a row above the grid (horizontal) or in a sidebar beside it (vertical). An unrecognized value logs a console warning and falls back to horizontal.

The list only shows products the current shopper is allowed to buy. Each product’s Purchase Eligibility rules in the Open Shop admin decide that, using the shopper’s account type and entitlements and those of the enroller they are shopping with.

  • Collections are filtered too. A collection returns only the products this shopper may buy, and a collection left with none gets no chip at all. That is how you build a collection that only some shoppers see: fill it with products limited by eligibility rules, and everyone else never sees it.
  • The referrer counts on the first visit. A shopper arriving through a ?referral= link is not attributed until os-referral-tracker resolves the link, which can be after the list has loaded. When the referral resolves, the list refetches once, so products limited to that referrer’s shoppers appear without a reload. A ?collection= in the same link is kept, so ?referral=jane&collection=boats still lands on Boats. Later page views already know the referrer and do not refetch.

Storefront entitlements uses this to show each rep’s shoppers a collection of products only they can buy.

shop.html
<os-product-list product-url-prefix="/products"></os-product-list>
<!-- With search enabled and filters in a sidebar -->
<os-product-list
product-url-prefix="/products"
search="true"
collections-orientation="vertical"
></os-product-list>
<!-- Scope the search to the selected collection instead of every product -->
<os-product-list
product-url-prefix="/products"
search="true"
search-scope="collection"
></os-product-list>

Product List screenshot

The product list renders the collection filter chips plus a responsive product grid. The chips expose these variables, in addition to the global tokens inherited by every component. (The grid columns are responsive and not exposed as variables.)

CSS variable Default
--os-chip-bg #f1f5f9
--os-chip-color var(--os-foreground)
--os-chip-hover-bg var(--os-border)
--os-chip-active-bg var(--os-primary)
--os-chip-active-color #fff
--os-chip-padding 6px 16px
--os-chip-radius 8px
--os-chip-font-size 16px
--os-chip-font-weight 500
--os-chip-line-height 1.5

Rendered only when search="true".

CSS variable Default
--os-product-list-search-bg #ffffff
--os-product-list-search-border 1px solid var(--os-border)
--os-product-list-search-color var(--os-foreground)
--os-product-list-search-radius 8px
--os-product-list-search-height 40px
--os-product-list-search-font-size 16px
--os-product-list-search-ring-color #0ea5e9
--os-product-list-search-ring-track var(--os-border)
--os-product-list-search-status-color var(--os-muted-foreground)
--os-product-list-search-status-size 14px
--os-product-list-search-status-min-height 200px
--os-product-list-search-error-bg #fef2f2
--os-product-list-search-error-color #b91c1c
CSS variable Default
--os-product-list-load-more-bg #ffffff
--os-product-list-load-more-border 1px solid var(--os-border)
--os-product-list-load-more-color var(--os-foreground)
--os-product-list-load-more-radius 8px
--os-product-list-load-more-font-size 14px

Applies when collections-orientation="vertical".

CSS variable Default
--os-product-list-vertical-filters-width 200px
--os-product-list-vertical-gap 32px
--os-product-list-scroll-margin 0
CSS variable Default
--os-spinner-color #3b82f6
--os-spinner-size 12px