Cards JS behaviour

Profile card

A profile over a gradient cover: the avatar rides the cover/body seam, the stats roll their digits, the follow button morphs between its two states (icon swap + label crossfade) and the small tabs carry a springing indicator.

Real scenarios

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

The author’s page, as it ships

The avatar rides the cover/body seam with the online dot breathing on its rim, the name carries the verified seal, and every stat rolls its digits in the page’s own numerals. The follow button morphs — icon swap, label crossfade, recolour — announces itself to screen readers, and rolls the follower count ±1 until the server’s own number lands; here each move also reports through a toast (the nx-follow / nx-unfollow / nx-message events riding the card). The small tabs carry a springing indicator and answer the arrow keys.

Negar Rostami Verified account

Writer & teacher of Persian typography @negar-types

Followers
12,840
Following
812
Essays
146

Fourteen years of setting Persian type for screens; the newsletter arrives every other Tuesday — one kata, one critique.

The experts directory

Omar arrives with following already true — the server rendered him that way, so the button lands in its settled state and unfollowing rolls his followers −۱. Lena is not followed yet. Neither passes follow-action, so the state stays in the browser and the nx-follow / nx-unfollow events bubble for you; name a Livewire method instead and it is called after the optimistic flip while the button holds still for the round-trip.

Omar Haddad

Senior infrastructure engineer @omar-infra

Followers
248
Answers
1,932
Runbooks
54

Lena Fischer

Data engineer @lena-data

Followers
186
Datasets
42
Notebooks
28

The on-call specialist

The lean edge: no photo anywhere — the initials come from the name over the brand gradient — no tabs, and the message button has become a plain link (message-href), so it navigates instead of dispatching. The score still arrives with its fraction (۴٫۹) in the page’s own digits.

Maryam Ghasemi

Support specialist · morning shift

Message
Tickets closed
342
Score
5
First reply (min)
8

The follow button is always there; without a followers-stat nothing rolls, the button only morphs.

Important props

Important props
Prop Type Default What it does
name / href string required / null The profile’s name — its first letters become the photo-less avatar; with href the name becomes a link.
role / handle string null The role under the name and the mono @handle beside it.
avatar / cover array null ['src' => …, 'alt' => …]: the avatar photo rides the cover/body seam and the cover photo sits over the brand gradient; a failed avatar image falls back to the name’s initials.
status / verified string / bool null / false The presence dot on the avatar’s rim (online | busy | away — only “online” breathes) and the gold verified seal beside the name.
stats / followersStat array / int [] / null Rows of ['label' => …, 'value' => …] in the page’s own digits; followersStat is the index of the follower figure that rolls ±1 with the button until the server’s number lands.
following / followAction / unfollowAction bool / string false / null The button starts in its followed state (the server’s render is the truth); naming a Livewire method calls it after the optimistic flip while the button waits the round-trip out — without them the nx-follow / nx-unfollow events bubble.
messageHref / messageAction string null The message button: message-href turns it into a link, message-action calls a Livewire method; without either, the nx-message event.
tabs / tab / labels array / string / array [] / null / [] Tabs as ['about' => 'About'] with a slot named after each key; the first tab opens and a springing indicator slides onto the choice; labels overrides the card’s own words and locale the digits and announcements.

Snippet

<x-nx::profile-card name="نگار رستمی" role="نویسنده و مدرس تایپوگرافی فارسی" handle="@negar-types"
    href="#" status="online" verified
    :avatar="['src' => $avatar, 'alt' => '']" :cover="['src' => $cover, 'alt' => '']"
    :stats="[
        ['label' => 'دنبال‌کننده', 'value' => 12840],
        ['label' => 'دنبال‌شده', 'value' => 812],
        ['label' => 'نوشته', 'value' => 146],
    ]"
    :followers-stat="0" :tabs="['about' => 'درباره', 'activity' => 'فعالیت']"
    x-on:nx-follow="$wire.ping('دنبال شد')" x-on:nx-unfollow="$wire.ping('لغو شد')">
    <x-slot:about><p>…زندگی‌نامه…</p></x-slot:about>
    <x-slot:activity><ul>…کارهای تازه…</ul></x-slot:activity>
</x-nx::profile-card>