ChallengeStatusFilter
The challenge status chips (the kit FilterChips radiogroup: one tab stop, arrows move and select): All, Live, Upcoming, Settling, Ended, Brand requests, with counts. Labels come from the provider's statusTables.pr.
import { ChallengeStatusFilter } from '@ergasti/bricks';Examples
Challenges table with status chips
The chips filter by status with counts; challengeColumns is the matching column preset (challenge, brand, status, dates, creators, sales, commission, waiting).
Code
import { useState } from 'react';
import { ChallengeStatusFilter, DataTable, challengeColumns } from '@ergasti/bricks';
import { challengeRows } from './pr';
function Challenges() {
const [chip, setChip] = useState('live');
const rows = challengeRows.filter((c) => chip === 'all' || c.status === chip);
return (
<div style={{ display: 'grid', gap: 14 }}>
<ChallengeStatusFilter value={chip} onChange={setChip} counts={{ all: 4, live: 2, upcoming: 1, settling: 1, ended: 0, needs_review: 2 }} />
<DataTable label="Challenges" columns={challengeColumns('en', { onOpen: () => {} })} rows={rows} rowKey={(r) => r.id} />
</div>
);
}Your own statuses, no "All"
statuses sets which chips show and in what order (default CHALLENGE_STATUSES); withAll={false} drops the "All" chip. With no counts, chips show no numbers.
Code
import { useState } from 'react';
import { ChallengeStatusFilter } from '@ergasti/bricks';
function Subset() {
const [chip, setChip] = useState('needs_review');
return <ChallengeStatusFilter value={chip} onChange={setChip} statuses={['needs_review', 'upcoming', 'live']} withAll={false} />;
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prChallengeStatusFilter, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
label | Challenge status | حالة التحدي |
all | All | الكل |
Design guidance
How the BRICKS design system uses ChallengeStatusFilter. Written in docs/content/components/ChallengeStatusFilter.md; the props above are read from the code, which wins where the two disagree.
The challenge status chips with counts (All, Live, Upcoming, Settling, Ended, Needs review) above the PR challenges table; use it to filter that table by status.
It is a kit FilterChips radiogroup preset for challenges: one tab stop, arrows move and select. Status words come from the provider's statusTables.pr, so they match PrStatusPill in the table.
Anatomy
- Radiogroup (
FilterChips, named "Challenge status"). - Chips: "All 4", "Live 2", "Upcoming 1", "Settling 1", "Ended 0", "Needs review 2"; the selected one filled.
Variants
| Prop | Effect |
|---|---|
counts | Numbers on chips; a missing key shows none (story NoCounts). |
statuses | Which statuses, in order (default CHALLENGE_STATUSES: live, upcoming, settling, ended, needs_review). |
withAll={false} | No "All" chip. |
States
Selected (value), focus ring, arrow-key selection.
Usage
const [chip, setChip] = useState('live');
const rows = challenges.filter((c) => chip === 'all' || c.status === chip);
<Card>
<ChallengeStatusFilter value={chip} onChange={setChip}
counts={{ all: 4, live: 2, upcoming: 1, settling: 1, ended: 0, needs_review: 2 }} />
<DataTable label="Challenges" columns={challengeColumns(language, { onOpen: openChallenge })} rows={rows} rowKey={(r) => r.id} />
</Card>Where it appears
- PR Portal › Affiliate programs › Challenges, above the table. Screens: PR · Challenges, PR · Challenges · Brand requests (Needs review).
Guidelines
Do
- Pass server counts for every chip, including
all. - Keep the mock's order.
Don't
- Don't use it for other entities; use
FilterChipsdirectly.
RTL and Arabic
- Chips flow right to left: "الكل", "جاي", "بيتقفل", "محتاج مراجعة".
Tokens
FilterChips (kit-chipf) tokens.
Accessibility
role="radiogroup"named "Challenge status"; chips are radios; roving tabindex: only the selected chip is in the tab order, arrows move and select.valuemust be'all'(withwithAll) or one ofstatuses. With a value that matches no chip, none shows as selected (the first chip is then the tab stop).
Found in the source
- ARIA attributes set:
aria-hidden. - Its tests cover: “has the presets’ shape and the brief’s columns in order, with sort keys and money figures”; “All + the statuses with counts, as a radiogroup moved by arrows”; “Arabic + RTL: arrows mirror”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
See also: Money · useBricks · useLanguage · BrandCell · IconSquare · PrStatusPill · DataTable · BrandRequestCard · BuilderStepCard · ChallengeAudienceFields · ChallengeBasicsFields
Source
src/pr/challenges/challengeColumns.tsx (line 110) on GitHub.