Skip to main content
Version: Next

Styles

Element appearance configuration on screen is done through configuring corresponding element style.

Style ClassDescription
Base Interface Elements
NavigationBarStyleNavigation bar style in chat
ChatLoadingStyleOverall chat loading screen style
ChatPlaceholderStyleEmpty chat state style (e.g., no messages)
ChatPlaceholderErrorStyleError display style (e.g., failed to load chat)
LoadingIndicatorStyleLoading indicator style (in messages, actions)
ChatInputStyleMessage input panel style in chat
ChatInputTextStyleText input container style
ChatInputVoiceStyleVoice message recording element style
ChatInputQuoteStyleQuote display element style above input field
SearchBarStyleSearch bar style in navigation bar
ToastAlertStyleToast notifications style
ScrollToMessageButtonStyleScroll to new messages button
PhotoPickerStylePhoto picker style (gallery/camera)
ProgressViewStyleProgress indicator style (file loading, etc.)
FileViewerStyleFile display style (PDF, documents)
ButtonStyleBase button style in chat
TextButtonStyleText button (no background)
IconButtonStyleIcon button
AudioPlayerStyleAudio player style (in chat or separate)
Message Styles
ChatMessagesStylesContainer for all user message type styles
ChatMessageStyleBase message style in chat
TextChatMessageStyleText message style
FileChatMessageStyleFile message style
SearchChatMessageStyleSearch highlight style in messages
ImageChatMessageStyleImage style in message
AudioChatMessageStyleAudio message style
SurveyChatMessageStyleSurvey/poll style in message
ScheduleChatMessageStyleSchedule/reminder message style
OperatorJoinedChatMessageStyleOperator connection message style
QuickReplyStyleQuick replies style
QuoteStyleMessage quoting display style
OpenGraphViewStyleOpenGraph display style in text messages

Each component has common base parameters described in ChatMessageStyle, for example:

/// Element corner radius (if applicable to element, otherwise ignored)
public var cornerRadius: CGFloat
/// Element background color
public var backgroundColor: UIColor
/// Element color (if applicable to element, otherwise ignored)
public var tintColor: UIColor

And unique parameters for each component. Full list available in API Documentation

Style can be created using base constructor:

let outcomeMessages = ChatMessagesStyles(components: components)
outcomeMessages.textMessageStyle.textStyle.color = .black
outcomeMessages.showAvatar = showOutcomeAvatar
outcomeMessages.bubbleErrorColor = .red

or using builder with closure for parameter configuration:

let outcomeMessages = ChatMessagesStyles.build(with: components) { messagesStyle in
messagesStyle.textMessageStyle.textStyle.color = .black
messagesStyle.showAvatar = showOutcomeAvatar
messagesStyle.bubbleErrorColor = .red
}

Existing style configuration is done through properties:

// Get search screen settings
let searchFlow = theme.flows.searchFlow
searchFlow.navigationBarStyle.hidden = false
searchFlow.navigationBarStyle.searchBarStyle.cancelButtonStyle.tintColor = .white
searchFlow.searchMessageStyle.matchTextStyle.color = .red
searchFlow.notFoundTextStyle = ChatTextStyle(font: typography.message, color: .white)

or using apply method with closure configuration:

// Apply search screen settings
theme.flows.searchFlow.apply {
$0.navigationBarStyle = NavigationBarStyle.build(with: components, configure: {
$0.hidden = false
$0.backButtonColor = .red
})
$0.searchMessageStyle.apply {
$0.matchTextStyle = .init(font: UIFont.systemFont(ofSize: 20), color: .systemGreen)
$0.nextImage = ChatImage(system: "chevron.forward", tintColor: .systemGreen)
}
$0.navigationBarStyle.searchBarStyle.cancelButtonStyle.tintColor = .red
$0.notFoundTextStyle = ChatTextStyle(font: typography.message, color: .red)
}
note

Current version has limitation on component configuration (reused from ChatComponents) through apply. Their configuration in one flow through apply may lead to their global change in theme. In this case, it's recommended to create new component specifically and configure it in required flow location.

note

Design system was applied to current chat in this version, not all parameters may have been considered. If configuration problems are discovered, contact support.