Skip to content

OrderList ​

Light container: status tabs (tabs JSON dual-channel [{ key, label, count?, disabled? }]) + order-card list slot (the host places oas-order-card / custom cards — no built-in card rendering; card content, styling and click behavior are fully owned by the host) + load-more (aligned with the goods-list sentinel protocol: sentinel + pending dedupe + slot-change release + hidden-container guard) + empty state. Tab switches fire oas-tab-change (detail { key, label }).

Two delivery options: the container (this component — tabs, bottom-reached loading and empty state out of the box) or the recipe (hand-assemble oas-tabs + oas-order-card, see “Assembly recipe” below).

Tabs + order-card slot ​

active is the current tab key (user clicks / keyboard activation write it back and fire; host writes are silent); count renders a badge and the accessible name derives from visible content (label + badge as continuous text). On switch the host swaps the slot content by key (the demo uses light cards as stand-ins):

Status tabs + order-card slot (switch swaps content)

Click a tab to see the oas-tab-change feedback and the list swap.

Load more (bottom-reached protocol) ​

Reaching the bottom fires oas-load-more (the sentinel triggers 240px early); the host sets loading to show the spinner + loading text, and appending order cards (slot change) releases the pending state; no-more shows “No more orders” and stops triggering:

Bottom-reached load more (demo button simulates) + end state

Order card 1: cotton tee (to ship)
Order card 2: canvas sneakers (shipped)
Order card 3: commuter bag (done)
Simulate bottom (append cards)Set no-more

Empty state ​

With no cards in the slot the empty state renders; the empty slot replaces it entirely (default i18n “No orders yet”):

Empty state (empty slot)

Done orders only go back six months — check All ordersView all orders

Assembly recipe (tabs + order-card, hand-assembled) ​

The container-free alternative — assemble oas-tabs + oas-order-card (for order pages that already own state management and only want the primitives):

html
<oas-tabs id="order-status" items='[{"key":"all","label":"All"},{"key":"pending","label":"Pending"}]'></oas-tabs>
<div id="order-cards">
  <oas-order-card order-no="NO.20261125001" status="pending" total="129">
    <oas-button slot="actions" size="small" type="primary">Pay now</oas-button>
  </oas-order-card>
</div>
<script>
  document.getElementById('order-status').addEventListener('oas-change', (e) => {
    // filter the order-cards children by e.detail.value
  })
</script>

Container and recipe are either-or: choose the container for tab keyboard nav / bottom-reached protocol / empty state out of the box; choose the recipe when you already own state management and want minimal dependencies.

Keyboard & accessibility ​

  • Tabs use role="tablist" + role="tab" (aria-selected; accessible names derive from visible content — label + badge continuous text, no aria-label wrapping); each tab's aria-controls points at the card area role="tabpanel" (id derived from the tabs input, unique per page instance).
  • Keyboard roving tabindex: arrow keys move focus, Home / End jump to the edges; manual activation — arrows move focus only, Enter / Space activates; disabled tabs are unreachable and inert.
  • Empty / loading / sentinel live outside the tabpanel semantics; the loading area is a role="status" + aria-live="polite" live region.
  • RTL mirrors via logical properties; colors are token-based (dark theme follows).

Custom styling notes ​

::part(tablist) is the horizontal tab strip (overflow-x scroll, scrollbar hidden); ::part(tab) pills (selected background uses --oas-color-primary, targetable via [aria-selected='true']); ::part(count) badge; card area ::part(body) is a vertical flex (slot gap --oas-space-3); bottom area ::part(more) + ::part(spinner). Slot cards never enter the shadow — card styling is owned by the host / oas-order-card.

API ​

oas-order-list ​

Attributes ​

AttributeDescriptionTypeDefault
activeCurrent tab key: user clicks / keyboard activation write it back and fire oas-tab-change; host writes are silent; defaults to the first tabstring—
loadingLoad-more loading state: the host sets it after receiving oas-load-more (spinner + loading text; setting it releases the pending bottom-reached state)boolean—
no-moreEnd state: shows “No more orders” and stops triggeringboolean—
tabsTab config JSON array [{ key, label, count?, disabled? }] (entries missing key or label are ignored; invalid JSON warns once and hides the tablist)OrderTab[] | string—

Property (JS property; see each row for attribute reflection) ​

PropertyDescriptionTypeDefault
activeCurrent tab key: get+set dual channel, writes reflect the active attribute (silent; only user interaction fires)string—
tabsTab config: get+set dual channel (array or JSON string), writes reflect the tabs attributeOrderTab[] | string—

Events ​

EventDescription
oas-load-moreFires when the sentinel enters the viewport (240px early) unless loading / no-more; after firing the component waits for the host to set loading or change slot content (appending cards); if the host does neither it stops triggering, detail: {}
oas-tab-changeFires after the user activates a tab, detail: { key, label }; re-clicking the active tab does not re-fire; host writes to active do not fire

Slots ​

NameDescription
defaultOrder card list: the host places oas-order-card / custom cards (cards stay in light DOM, never moved; content, styling and clicks are fully owned by the host)
emptyEmpty state content (renders when the slot has no cards; default “No orders yet” text)

Released under the MIT OR Apache-2.0 License.