Skip to Content
BBRICKSv0.7.4
BlocksGroups

MembersPicker

The group form's creator picker (.pick): a legend with the live count, a search box that narrows the list (names, any case), and a scrolling list of checkboxes, each with its picture, name and tier. Ticked creators stay ticked while hidden by the search.

import { MembersPicker } from '@ergasti/bricks';

Examples

Pick creators

A searchable checklist of people with their tiers; selected holds the ids.

Code
import { useState } from 'react';
import { MembersPicker } from '@ergasti/bricks';
import { blocksData } from './sample-data';

function Pick() {
  const [selected, setSelected] = useState<number[]>([9, 2]);
  return (
    <div style={{ maxWidth: 460 }}>
      <MembersPicker people={blocksData.MINE} selected={selected} onChange={setSelected} />
      <small>{selected.length} selected</small>
    </div>
  );
}

Nobody picked

error marks the checklist invalid and says why (a group needs at least one creator); labels renames single words such as the legend.

Code
import { useState } from 'react';
import { MembersPicker } from '@ergasti/bricks';
import { blocksData } from './sample-data';

function Invalid() {
  const [selected, setSelected] = useState<number[]>([]);
  return (
    <div style={{ maxWidth: 460 }}>
      <MembersPicker people={blocksData.MINE.slice(0, 5)} selected={selected} onChange={setSelected} error={selected.length ? undefined : 'Pick at least one creator.'} labels={{ legend: 'Group members' }} />
    </div>
  );
}

Props

Prop

Type

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key membersPicker, or with the component's own prop where it has one. A {name} is a value the component fills in.

membersPicker
KeyEnglishArabic
legendCreatorsصنّاع المحتوى
picked({n} picked)(اخترت {n})
searchSearch creatorsدوّر على صانع محتوى
noMatchNo creators match “{q}”.مفيش صانع محتوى اسمه “{q}”.
noneNo creators to pick yet.لسه مفيش صنّاع محتوى تختار منهم.

Design guidance

How the BRICKS design system uses MembersPicker. Written in docs/content/components/MembersPicker.md; the props above are read from the code, which wins where the two disagree.

A searchable checkbox list of creators with a live "(N picked)" count; use it to choose a group's members inside GroupForm.

It is the mock's .pick in the New / Edit group modal. The search narrows by name (any case); ticked creators stay ticked while the search hides them. Each row shows the photo, name and tier.

Anatomy

  1. Fieldset: fieldset.kit-blk-pickset, described by the error.
  2. Legend: "Creators" + muted "(3 picked)" (aria-live="polite").
  3. Search: input[type=search], 42px, "Search creators".
  4. List: ul.kit-blk-pick, max height 250 with scroll, 1px line, radius 14; rows are labels with a checkbox, 28px avatar, name (ellipsis) and TierChip at the end.
  5. Empty lines: "No creators to pick yet." / "No creators match “sa”."
  6. Error: .kit-field-err.

Variants

None; the list adapts to people.

States

StateTrigger
Hoverrow --soft.
Focus-visibleinset ring on the row.
Tickedselected contains the id.
Filteredsearch text.
No matchsearch hides everyone.
No peoplepeople=[].
Errorerror.

Types

BlockPerson (people): { id, name, avatarUrl?, tier?, handle?, sub? }. MembersPickerCopy (labels): legend, picked(n), search, noMatch(q), none.

Usage

const [ids, setIds] = useState<number[]>([]);
<MembersPicker people={creators} selected={ids} onChange={setIds}
  error={submitted && ids.length === 0 ? 'Pick at least one creator' : undefined} />

Where it appears

  • Brand › Creators › Groups › New / edit group modal (inside GroupForm) (BrandCreators).

Guidelines

Do

  • Pass everyone pickable (the mock: all creators not removed).

Don't

  • Don't use it for hundreds of people without server search.

RTL and Arabic

  • Mirrors; tier chip moves to the left end. Arabic: "صنّاع المحتوى", "(اخترت 3)", "دوّر على صانع محتوى".

Tokens

--line, --soft, --card, --rasp, --focus-ring-inset, --focus-ring-field, --bad, --ink-3.

Accessibility

  • Fieldset + legend; native checkboxes in labels; the count is a polite live region; the search has a label.

Found in the source

  • ARIA attributes set: aria-describedby, aria-live, aria-label.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Avatar · useLanguage · CommissionInput · CommissionRate · GroupCard · GroupCommissionPill

Source

src/blocks/groups/MembersPicker.tsx (line 38) on GitHub.

On this page