Cards JS behaviour

Order tracking

Where an order is and how it got there: a horizontal route that fills up to the current step (a pinging marker while it travels), a tone-stitched event log beneath, and the live status on a badge — refreshes itself under wire:poll.

Real scenarios

The component as it is used in a product — not a specimen grid.

A parcel on the Bursa → Istanbul road

The fill draws itself up to the current step (a pinging marker while it travels), the badge breathes while the order runs and the event log slides in row by row. current rides a Livewire property here, so the button walks the whole route — and on a real page wire:poll.30s does it without anyone clicking.

Order tracking

Order no.: ۱۴۰۴-۰۸۲۱۵

Carrier
SwiftPost
Expected delivery
In 2 days
Running
  1. Order placed

  2. Paid

  3. Packed

  4. In transit

    Bursa → Istanbul

  5. With the courier

  6. Delivered

Events

  1. Order placed and sent to the warehouse

    Istanbul

  2. Payment confirmed

    Bank gateway

  3. Packing ran 40 minutes late

    Bursa

  4. Left the distribution centre

    Bursa

Dates can be real dates (they read as relative time in the app’s language) or plain labels; the step numbers are formatted in the app’s digits.

A delivery that failed

No current here at all — every step carries its own state, so the route can fork away from a straight line (the parcel may yet go back to the warehouse). The failed badge stops breathing with :live="false" and the log stitches danger, info and warning rows by tone.

Order tracking

Order no.: 981,120

Carrier
SpeedEx
Expected delivery
Second attempt: tomorrow ۱۰–۱۴
Delivery failed
  1. Order placed

  2. In transit

  3. With the courier

  4. Delivered

  5. Back to the warehouse

Events

  1. Delivery failed — recipient unreachable

    Istanbul, district ۶

  2. SMS sent to the recipient

    Second attempt tomorrow

  3. Held at the courier hub

    Returns to the warehouse after 3 days

An order that just landed

The bare minimum: three steps, current at the first, no events yet — the block says so itself instead of an empty box. In a shop this is the screen right after checkout.

Order tracking

Order no.: ۴۵۲۱

Queued
  1. Order placed

  2. Packing

  3. Delivered

Events

  1. No events yet

Important props

Important props
Prop Type Default What it does
steps array [] Step keys: id, title, description, icon, time (a date → relative time, or a plain label) and state (complete | current | upcoming), which wins over current.
current string | int null The current step’s id or index; the steps before it read as complete, the ones after as upcoming.
events array [] Keys: id, title, description, place, tone (success | warning | info | danger), icon, time; empty and the block says so itself.
status / statusLabel / live string / string / bool null / null / true The status on the badge: running | success | failed | queued | canceled; a custom label and whether its dot breathes.
number / carrier / eta string null The order number (numeric ones get locale digits), the carrier and the expected delivery in the header.
label / labels / locale string / array / string null / [] / null The card’s accessible name, overrides for the block’s own words, and the locale for digits and dates.
wire:poll و x-on:* attribute — Any wire/event attribute lands on the root — wire:poll.30s="checkOrder" morphs the whole block into its fresh server state.

Snippet

<x-nx::order-tracking number="۱۴۰۴-۰۸۲۱۵" status="running" carrier="تندپست" eta="۲ روز دیگر"
    :steps="[
        ['id' => 'placed', 'title' => 'ثبت سفارش', 'icon' => 'file', 'time' => now()->subDays(2)],
        ['id' => 'transit', 'title' => 'در مسیر', 'icon' => 'zap'],
        ['id' => 'done', 'title' => 'تحویل شد', 'icon' => 'home'],
    ]"
    current="transit"
    :events="[['title' => 'بسته از مرکز توزیع خارج شد', 'place' => 'بورسا', 'time' => now()->subHours(2), 'tone' => 'success']]" />