MessageDrawer
A sent message, opened from the Messages history (the PR mock v3's openMsg): a 52px lilac messages square beside the subject (20px) and "Sent 14 Nov 2026 by Mona", the message on soft grey, Creators and Opened as two stat tiles, From / To / Not opened, a muted note, then a ruled "Send another to the same people". On the kit Drawer (focus trap, Escape, scrim).
import { MessageDrawer } from '@ergasti/bricks';Examples
A sent message
Open a row of the Messages history: the subject and who sent it when, the message on soft grey, Creators and Opened, From / To / Not opened, and "Send another to the same people", which hands the message back so you can open your composer with the same sender and audience. "Not opened" defaults to messageNotOpened(creators, openPercent) (the creators who have not opened it, rounded); pass notOpened for your server's own figure.
Code
import { Button, MessageDrawer, type MessageRow } from '@ergasti/bricks';
import { useState } from 'react';
import { messages } from './pr';
function OpenAMessage() {
const [open, setOpen] = useState<MessageRow | null>(null);
const [again, setAgain] = useState<string | null>(null);
return (
<div style={{ display: 'grid', gap: 10, justifyItems: 'start' }}>
{messages.slice(0, 3).map((m) => <Button key={m.id} size="sm" onClick={() => setOpen(m)}>{m.subject}</Button>)}
<small>{again ? `Compose again to: ${again}` : 'Pick a message'}</small>
<MessageDrawer open={open !== null} message={open} onClose={() => setOpen(null)} onSendAnother={(m) => { setOpen(null); setAgain(m.subject); }} />
</div>
);
}Arabic
Code
import { Button, MessageDrawer } from '@ergasti/bricks';
import { useState } from 'react';
import { messages } from './pr';
function Arabic() {
const [open, setOpen] = useState(false);
return (
<>
<Button size="sm" onClick={() => setOpen(true)}>افتح الرسالة</Button>
<MessageDrawer open={open} message={messages[0]} onClose={() => setOpen(false)} onSendAnother={() => setOpen(false)} language="ar" />
</>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prMessageDrawer, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
sent | Sent {when} by {by} | بعتها {by} يوم {when} |
body | Message | الرسالة |
creators | Creators | صنّاع المحتوى |
opened | Opened | اتفتحت |
from | From | من |
to | To | لـ |
notOpened | Not opened | متفتحتش |
trndr | TRNDR | TRNDR |
where | Creators see it in their TRNDR app notifications. | صنّاع المحتوى بيشوفوها في إشعارات تطبيق TRNDR. |
again | Send another to the same people | ابعت رسالة تانية لنفس الناس |
Design guidance
How the BRICKS design system uses MessageDrawer. Written in docs/content/components/MessageDrawer.md; the props above are read from the code, which wins where the two disagree.
A sent message opened from the PR Portal's Messages history: the subject and who sent it when, the message, Creators and Opened, From / To / Not opened, and "Send another to the same people"; open it when PR clicks a row of the history table.
It is the PR v3 mock's openMsg drawer, on the kit Drawer (focus trap, Escape, scrim) with the PR header style and a ruled footer. It takes the same MessageRow the history table's messageColumns renders, so the row you clicked is the drawer's data. It draws nothing while message is null. Use it instead of composing a Drawer with tiles and a key-value list by hand.
Anatomy
- Drawer (
.kit-drawer.kit-pr-msgd, 420px wide,headerStyle="pr",footerDivider). - Lead: a 52px lilac messages
IconSquare. - Title: the subject (20px,
dir="auto"); hint: "Sent 14 Nov 2026 by Mona". - Body: the message on
--soft, radius 16, 13px, line breaks kept (white-space: pre-line). - Tiles: Creators and Opened, two
Tile tone="plain" size="stat" valueSize="md"with a 1px line. - Facts (
<dl class="kit-pr-kv">): From (the brand, or "TRNDR"), To (AudienceLabel), Not opened. - Note (12.5px muted): "Creators see it in their TRNDR app notifications."
- Footer (with
onSendAnother): a full-width ink "Send another to the same people".
Variants
| Prop | Look | When to use |
|---|---|---|
message.sender null / a brand | From "TRNDR" / the brand's name | Sent by TRNDR, or on a brand's behalf. |
message.audience | To: all creators, a brand's creators, a group, a tier, or picked creators | As the message was sent. |
onSendAnother | Footer button | The app has a composer to reopen; left out, no footer button. |
notOpened | Your server's figure | Default messageNotOpened(creators, openPercent). |
note | Your line, or null for none | Default "Creators see it in their TRNDR app notifications.". |
States
| State | How |
|---|---|
| Closed / open | open; Escape, the scrim and × call onClose. |
| No message | message={null}: nothing renders. |
| Long message | Wraps (overflow-wrap: anywhere), keeps line breaks; the drawer body scrolls. |
| Opened out of range | openPercent is clamped to 0–100 and rounded. |
Usage
// PR Portal › Messages: a history row opens the drawer; "Send another" reopens the composer for the same people
import { useState } from 'react';
import { DataTable, MessageDrawer, messageColumns, type MessageRow } from '@ergasti/bricks';
const glow = { id: 'glow', name: 'Glow Lab', color: '#C7325C' };
const rows: MessageRow[] = [
{
id: 1, subject: 'Winter top 10: 2 weeks left',
body: 'Two weeks left in Winter top 10. Share your Glow Lab coupon in stories this weekend.',
sender: glow, audience: { kind: 'brand', brand: glow }, creators: 86, openPercent: 71, sent: '14 Nov 2026', by: 'Mona',
},
];
export function MessagesHistory({ compose }: { compose: (from: MessageRow['sender'], to: MessageRow['audience']) => void }) {
const [opened, setOpened] = useState<MessageRow | null>(null);
return (
<>
<DataTable label="Sent messages" columns={messageColumns('en')} rows={rows} rowKey={(m) => m.id} onRowClick={(m) => setOpened(m)} />
<MessageDrawer
open={opened !== null}
message={opened}
onClose={() => setOpened(null)}
onSendAnother={(m) => { setOpened(null); compose(m.sender, m.audience); }}
/>
</>
);
}// Sent by TRNDR to a tier, with the server's own not-opened count and no note
import { MessageDrawer, type MessageRow } from '@ergasti/bricks';
const fromTrndr: MessageRow = {
id: 2, subject: 'New: gift challenges', body: 'Gift challenges are live. Check your app for the ones you can join.',
sender: null, audience: { kind: 'tier', tier: 'elite' }, creators: 120, openPercent: 64, sent: '10 Nov 2026', by: 'Omar',
};
export function TrndrMessage({ open, close }: { open: boolean; close: () => void }) {
return <MessageDrawer open={open} message={fromTrndr} onClose={close} notOpened={41} note={null} />;
}Where it appears
- PR Portal › Messages › a row of the message history (PR · Messages).
Guidelines
Do
- Pass the same
MessageRowthe table shows, so the drawer and the row never disagree. - Pass
notOpenedwhen the server counts it; the default is a rounded estimate from the percentage. - Close the drawer before opening the composer from
onSendAnother. - Pass
inertRef(the app root) when the app has portals outside it that must stay usable.
Don't
- Don't edit a sent message here; it is a record. Sending again starts a new message.
- Don't add a second action to the footer; the mock has one. It is
ink, notrasp: it opens the composer, and the composer's Send is the raspberry action. - Don't use it for the brand's own history (Brand dashboard › Messages); that is
MessagesPanel/MessageHistoryList.
RTL and Arabic
- The drawer slides from the left in Arabic and mirrors its header and footer.
- Its words: "بعتها Mona يوم 14 Nov 2026", "الرسالة", "صنّاع المحتوى", "اتفتحت", "من", "لـ", "متفتحتش", "صنّاع المحتوى بيشوفوها في إشعارات تطبيق TRNDR.", "ابعت رسالة تانية لنفس الناس".
- Subject and body are
dir="auto"; counts use Latin digits (count).
Tokens
--drawer-w (420px here), --soft, --line, --ink, --ink-3, --min-touch-target; Drawer and Tile tokens.
Accessibility
- The kit
Drawer:role="dialog"+aria-modal, named by the subject, focus trapped and returned, Escape closes, the outside inert. - The message is announced with a visually hidden "Message:" prefix.
- Stats are
Tiles with label and value; From / To / Not opened is a<dl>. Names are isolated with<bdi>; the percentage is LTR. - The footer button is at least 44px tall on touch tiers (≤1024px).
Found in the source
- No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
messageColumns,DataTable: the history it opens from.AudienceLabel,SenderCell: the To / From cells.messageNotOpened: the default Not opened figure.Drawer,DetailsDrawer: other drawers.MessagesPanel,MessageHistoryList: the brand-side history.
See also: Button · Tile · useLanguage · IconSquare · AnnouncementComposer · AudiencePicker · ChannelPicker
Source
src/pr/messages/MessageDrawer.tsx (line 64) on GitHub.