MessageHistoryItem
One sent message, read-only: its name, channel and status, the date, who sent it ("Sent by TRNDR on your behalf" or by the brand), the text in the page's language (the other language when that one is empty), who it went to, and how many it was sent to and delivered. An article named by the message and its date.
import { MessageHistoryItem } from '@ergasti/bricks';Examples
One message
The name, channel, status, when it was sent, who sent it, the audience and how many it reached; the body is shown in the page's language when the message has it.
Code
import { MessageHistoryItem, type BrandMessage } from '@ergasti/bricks';
const messages: BrandMessage[] = [
{ id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
{ id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
{ id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];
function Item() {
return <div style={{ maxWidth: 620 }}><MessageHistoryItem message={messages[0]} /></div>;
}History with a filter
A list of messages with a "sent by" filter, a pager slot, and loading, error and empty states.
Code
import { MessageHistoryList, type BrandMessage } from '@ergasti/bricks';
import { useState } from 'react';
import type { MessageSentByFilter } from '@ergasti/bricks';
const messages: BrandMessage[] = [
{ id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
{ id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
{ id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];
function History() {
const [sentBy, setSentBy] = useState<MessageSentByFilter>('all');
const shown = messages.filter((m) => sentBy === 'all' || m.sent_by === sentBy);
return <div style={{ maxWidth: 620 }}><MessageHistoryList messages={shown} sentBy={{ value: sentBy, onChange: setSentBy }} /></div>;
}Messages page
The history plus a way to ask TRNDR to send something (onContact or contactUrl) and a slot for the automatic messages.
Code
import { MessagesPanel, type BrandMessage } from '@ergasti/bricks';
const messages: BrandMessage[] = [
{ id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
{ id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
{ id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];
function Panel() {
return <div style={{ maxWidth: 680 }}><MessagesPanel onContact={() => {}} history={{ messages }} automatic={<p className="kit-muted">Welcome and payout messages are sent automatically.</p>} /></div>;
}Loading, error and empty
status="loading" and status="error" (with error for the reason and onRetry for Try again) replace the list; an empty messages says nothing was sent yet.
Code
import { Card, MessageHistoryList, type BrandMessage } from '@ergasti/bricks';
const messages: BrandMessage[] = [
{ id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
{ id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
{ id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];
function States() {
return (
<div style={{ maxWidth: 620, display: 'grid', gap: 16 }}>
<Card><MessageHistoryList messages={[]} status="loading" /></Card>
<Card><MessageHistoryList messages={[]} status="error" error="Messages could not be loaded. Check your connection." onRetry={() => {}} /></Card>
<Card><MessageHistoryList messages={[]} /></Card>
</div>
);
}With a pager
pager sits under the list: pass the kit Pager and fetch the page on change. labels and itemLabels override single words (here the list's name and the not-sent line).
Code
import { MessageHistoryList, Pager, type BrandMessage } from '@ergasti/bricks';
import { useState } from 'react';
const messages: BrandMessage[] = [
{ id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
{ id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
{ id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];
function Paged() {
const [page, setPage] = useState(1);
return (
<div style={{ maxWidth: 620 }}>
<MessageHistoryList
messages={messages.slice(page - 1, page + 1)}
pager={<Pager page={page} lastPage={2} total={3} perPage={2} loading={false} label="Messages" onPage={setPage} />}
labels={{ label: 'Messages to Glow Lab creators' }} itemLabels={{ notSent: 'Waiting to go out' }}
/>
</div>
);
}Contact by link
contactUrl (the API's contact_url) makes "Contact TRNDR" a link; empty or null hides it. The history takes the same states as the list.
Code
import { MessagesPanel, type BrandMessage } from '@ergasti/bricks';
const messages: BrandMessage[] = [
{ id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
{ id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
{ id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];
function PanelLink() {
return <div style={{ maxWidth: 680 }}><MessagesPanel contactUrl="https://wa.me/201000000000" history={{ messages: [], status: 'loading' }} /></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 messageHistoryItem, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
itemLabel | {name}, {date} | {name}، {date} |
notSent | Not sent yet | لسه ماتبعتتش |
byTrndr | Sent by TRNDR on your behalf | بعتها فريق TRNDR بالنيابة عنك |
byBrand | Sent by you | إنت اللي بعتها |
to | To | لـ |
audience.all | All your creators | كل صنّاع المحتوى بتوعك |
audience.rule | Creators matching a rule | صنّاع المحتوى اللي مطابقين لقاعدة |
audience.groups | Groups: {names} | المجموعات: {names} |
audience.tiers | Tiers: {names} | المستويات: {names} |
audience.picked | 2 picked creators | ليس رقمًا صانع محتوى متختارين |
listSeparator | , | ، |
recipients | Sent to | اتبعتت لـ |
delivered | Delivered | وصلت |
deliveredOf | {p}% | {p}% |
unknown | — | — |
noBody | No text in this language. | مفيش نص باللغة دي. |
channels.sms | SMS | SMS |
channels.whatsapp | واتساب | |
statuses.sent | Sent | اتبعتت |
statuses.delivered | Delivered | وصلت |
statuses.sending | Sending | بتتبعت |
statuses.scheduled | Scheduled | متجدولة |
statuses.failed | Failed | ماوصلتش |
statuses.draft | Draft | مسودة |
Design guidance
How the BRICKS design system uses MessageHistoryItem. Written in docs/content/components/MessageHistoryItem.md; the props above are read from the code, which wins where the two disagree.
One sent message, read-only: its name, channel and status pills, the date, who sent it, the text in the page's language, who it went to, and how many it was sent to and delivered; use it inside MessageHistoryList.
Brands do not send messages to creators; TRNDR does (the v3 brand mock's menu notes "messages to creators moved to the PR portal"). This block shows the history the API returns, field names unchanged (body_en, sent_at, sent_by). The body shows in the page language, or the other language (marked with its own lang and direction) when that one is empty.
Anatomy
- Article:
article.kit-blk-msg, named "Spring launch, 3 Nov 2026" (or "Not sent yet"). - Head: name
h3; channelPill(mute: "SMS", "WhatsApp"); statusPillby tone; date (visual only). - Sender: "Sent by TRNDR on your behalf" (
trndrstyle) or "Sent by you". - Body: the text with
lang/dir, or muted "No text in this language." - Facts:
dl: To (audience words), Sent to, Delivered (+ "· 94%").
Variants
status | Pill tone | Text |
|---|---|---|
sent, delivered | ok | "Sent", "Delivered" |
sending, scheduled | warn | "Sending", "Scheduled" |
failed | bad | "Failed" |
draft / other | mute | "Draft" / the key itself |
audience.kind | To |
|---|---|
all | "All your creators" |
rule | "Creators matching a rule" |
group | "Groups: Top sellers, New this month" |
tier | "Tiers: Elite, Rising" (tier names from the provider) |
picked | "12 picked creators" |
States
| State | Trigger |
|---|---|
| Not sent | sent_at: null: "Not sent yet". |
| Unknown counts | recipients / delivered null: "—", no percent. |
| Other-language body | page-language body empty: the other one, in its direction. |
| No body | both empty: "No text in this language." |
Types
Helper: messageBody(message, lang).
BrandMessage (message): { id, name, body_en, body_ar, channel, status, sent_at, sent_by: 'trndr_on_behalf' | 'brand', audience: { kind, groups?, tiers? }, recipients, delivered }.
Usage
<MessageHistoryItem message={{
id: 31, name: 'Spring launch', channel: 'whatsapp', status: 'delivered', sent_at: '2026-11-03T10:00:00Z',
sent_by: 'trndr_on_behalf', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] },
body_en: 'New spring collection is live. Share your coupon this week for double commission.', body_ar: null,
recipients: 120, delivered: 113,
}} />Where it appears
- Not in the v3 brand mock (built for the live console's Messages screen; blocks inventory). Rendered by
MessageHistoryListinMessagesPanel.
Guidelines
Do
- Pass API rows unchanged.
Don't
- Don't add send or edit actions; the brand's view is read-only.
RTL and Arabic
- Body direction follows its language, not the page. Counts LTR. Arabic: "بعتها فريق TRNDR بالنيابة عنك", "وصلت", "واتساب".
Tokens
--soft, --ink-2, --ink-3, --lilac-ink (the TRNDR sender line), --lh-ar; pill tones (ok / warn / bad / mute).
Accessibility
- An
articlenamed by the message and date; the visual date isaria-hidden(already in the name). - Body carries
lang, so screen readers switch voice.
Found in the source
- ARIA attributes set:
aria-label,aria-hidden.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
MessageHistoryList,MessagesPanel; PR PortalMessagePreviewandAnnouncementComposer(where TRNDR writes them).
See also: Pill · useBricks · useLanguage · Card · Pager
Source
src/blocks/messages/MessageHistoryItem.tsx (line 131) on GitHub.