Menus & navigation JS behaviour

Member selector

A searchable multi-select of people with per-person roles; the trigger’s avatar stack updates on every pick and the “+n” rolls in Persian digits.

Real scenarios

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

Assign the shop redesign

Open the stack and search (try “sara”); ticking someone adds them and unlocks their role select. Roles post as name_roles[id] and land in state.teamRoles.

  • Ava Karimi Editor ava@nabu.example
  • Soheil Nouri Editor soheil@nabu.example

Important props

Important props
Prop Type Default What it does
members array [] Each member: id, name, email and optional avatar.
value / wire:model array [] The chosen ids; the checkboxes post as name[].
roles-model / roles string · array null · [] The wire:model path for roles and their current values; each row’s select binds rolesModel.{id}.
role-options / default-role array · string بیننده/ویرایشگر/مدیر The role choices and the default for freshly picked rows.
max int 4 Avatars shown on the trigger before the rest fold into “+n”.

Snippet

<x-nx::member-selector name="team" :members="$people" :value="$state['team'] ?? []"
    wire:model.live="state.team" roles-model="state.teamRoles" :roles="$state['teamRoles'] ?? []" max="5"
    :role-options="[['value' => 'viewer', 'label' => 'بیننده'], ['value' => 'editor', 'label' => 'ویرایشگر']]" />