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.
| Key | English | Arabic |
|---|---|---|
legend | Creators | صنّاع المحتوى |
picked | ({n} picked) | (اخترت {n}) |
search | Search creators | دوّر على صانع محتوى |
noMatch | No creators match “{q}”. | مفيش صانع محتوى اسمه “{q}”. |
none | No 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
- Fieldset:
fieldset.kit-blk-pickset, described by the error. - Legend: "Creators" + muted "(3 picked)" (
aria-live="polite"). - Search:
input[type=search], 42px, "Search creators". - List:
ul.kit-blk-pick, max height 250 with scroll, 1px line, radius 14; rows are labels with a checkbox, 28px avatar, name (ellipsis) andTierChipat the end. - Empty lines: "No creators to pick yet." / "No creators match “sa”."
- Error:
.kit-field-err.
Variants
None; the list adapts to people.
States
| State | Trigger |
|---|---|
| Hover | row --soft. |
| Focus-visible | inset ring on the row. |
| Ticked | selected contains the id. |
| Filtered | search text. |
| No match | search hides everyone. |
| No people | people=[]. |
| Error | error. |
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.
Related
GroupForm(its parent),CreatorCell,TierChip.
See also: Avatar · useLanguage · CommissionInput · CommissionRate · GroupCard · GroupCommissionPill
Source
src/blocks/groups/MembersPicker.tsx (line 38) on GitHub.