suiss/ui · Component
Message
Lays out a single chat message with an optional avatar, header and footer.
Message is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Message arranges one message row: an optional MessageAvatar and a MessageContent column. Inside the content, place an optional MessageHeader (such as a sender name), one or more bubbles, and an optional MessageFooter (such as a timestamp or read receipt). Wrap consecutive messages in MessageGroup to stack them.
Message handles layout only. Pair it with Bubble for the message surface and with Message Scroller for a scrolling transcript.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
-
Add the
cnhelper. -
Copy the source into
components/ui/message.tsx:
- Update the import paths to match your project.
Usage
Set align="end" for messages sent by the current user. The row reverses, so the avatar moves to the end, and the content's children and the footer align to the end edge.
Examples
Align end
A message aligned to the end, as used for outgoing messages.
With header and footer
A message with a sender name above the bubble and a timestamp below it.
Conversation
A MessageGroup with an incoming message of two bubbles and an outgoing reply.
API Reference
MessageGroup
Stacks several messages vertically.
Also accepts the props of React.ComponentProps<"div">.
Message
The row for one message that sets its alignment.
| Prop | Type | Default | Description |
|---|---|---|---|
align | "start" | "end" | "start" | Aligns the message to the start or end edge; end reverses the row for outgoing messages. |
Also accepts the props of React.ComponentProps<"div">.
MessageAvatar
A round container for the sender's avatar, aligned to the bottom of the row.
Also accepts the props of React.ComponentProps<"div">.
MessageContent
The column that holds the header, bubbles and footer.
Also accepts the props of React.ComponentProps<"div">.
MessageHeader
Small secondary text above the bubbles, such as the sender name.
Also accepts the props of React.ComponentProps<"div">.
MessageFooter
Small secondary text below the bubbles, such as a timestamp.
Also accepts the props of React.ComponentProps<"div">.
Notes
- Styling hooks:
data-slotvaluesmessage-group,message,message-avatar,message-content,message-headerandmessage-footer.Messagealso setsdata-align. - When a footer is present, the avatar shifts up to line up with the last bubble rather than the footer.
- Header and footer drop their horizontal padding when the message contains an element with
data-variant="ghost". - Header and footer text uses the
muted-foregroundcolor; the avatar background usesmuted.

Message is a horizontal View that places an avatar next to a column of bubbles. Its align prop puts the row on the leading (start) or trailing (end) side and passes the alignment to any Bubble inside through context.
MessageGroup stacks several messages into a conversation. MessageHeader and MessageFooter hold small secondary text, such as a sender name or a timestamp.
Installation
The CLI also adds what it builds on: Bubble, Icon, Text.
Manual
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Put a MessageAvatar and a MessageContent inside each Message, and place Bubble components, a MessageHeader and a MessageFooter in MessageContent.
Plain strings in MessageHeader and MessageFooter are wrapped in Text for you, so you can pass text directly or mix it with an Icon.
When MessageContent contains a MessageFooter, the avatar shifts up so it lines up with the last bubble instead of the footer.
Examples
Align end
A message aligned to the trailing side, as for the current user.

With header and footer
A message with a sender name above and a timestamp below.

Conversation
A MessageGroup with an incoming and an outgoing message, including a read receipt footer.

API Reference
MessageGroup
Vertical stack of messages.
Also accepts the props of ViewProps.
Message
Row that holds the avatar and content and sets the alignment.
| Prop | Type | Default | Description |
|---|---|---|---|
align | MessageAlign | "start" | Side of the row: start (default) or end. Also aligns nested bubbles and the footer. |
Also accepts the props of ViewProps.
MessageAvatar
Round slot for an avatar, pinned to the bottom of the row.
Also accepts the props of ViewProps.
MessageContent
Column of bubbles built on BubbleGroup.
Also accepts the props of React.ComponentProps<typeof BubbleGroup>.
MessageHeader
Small secondary text above the bubbles.
Also accepts the props of ViewProps.
MessageFooter
Small secondary text below the bubbles, aligned with the message side.
Also accepts the props of ViewProps.
Accessibility
- Messages are plain
ViewandTextelements, so screen readers read the header, bubble text and footer in order. - Give avatars without visible text, such as images, an
accessibilityLabel.
Notes
- Header and footer text use
text-xs text-muted-foreground, with icons atsize-3.5. - The avatar slot uses
bg-muted. - Light and dark colors follow the system appearance.



