screens/DSChatBubble

DSChatBubble

screens
since v2.0

Message 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

PropTypeDefaultDescription
messagereqDSMessageโ€”Message model (text, type, timestamp, status).
showAvatarBooltrueShows sender avatar (received only).
onLongPress(() -> Void)?nilLong-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)
}

Related Components