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.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

Variants

chat-bubble-sent screenshot

.sent

Right-aligned. Primary colour background.

chat-bubble-received screenshot

.received

Left-aligned. Secondary surface background.

chat-bubble-system screenshot

.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