screens/DSChatBubble
DSChatBubble
screensMessage bubble with sent/received alignment, timestamp, delivery status indicators, and support for text, image, and audio messages.
iOS 17+macOS 14+
Purpose
Chat UIs, comment threads, and in-app messaging screens.
Variants
sent
.sent
Right-aligned. Primary colour background.
received
.received
Left-aligned. Secondary surface background.
system
.system
Centred. Used for event messages like 'User joined'.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| messagereq | DSMessage | โ | Message model (text, type, timestamp, status). |
| showAvatar | Bool | true | Shows sender avatar (received only). |
| onLongPress | (() -> Void)? | nil | Long-press action (shows context menu). |
Examples
Chat screen
Scrollable message list.
swift
ScrollView {
LazyVStack(spacing: DSSpacing.xs) {
ForEach(messages) { message in
DSChatBubble(
message: message,
showAvatar: message.senderId != currentUser.id
) {
showMessageActions(message)
}
}
}
.padding(.horizontal, DSSpacing.md)
}