Package 

Interface ChatComponentFactory


  • 
    public interface ChatComponentFactory
    
                        

    Factory for creating stateless components that are used by default throughout the Chat UI.

    Example of a custom ChatComponentFactory implementation that changes the default UI of the trailing content of the channel list header element:

    ChatTheme(
        componentFactory = object : ChatComponentFactory() {
            @Composable
            override fun RowScope.ChannelListHeaderTrailingContent(
                params: ChannelListHeaderTrailingContentParams,
            ) {
                IconButton(onClick = params.onHeaderActionClick) {
                    Icon(
                        imageVector = Icons.Default.Add,
                        contentDescription = "Add",
                    )
                }
            }
        }
    ) {
        // Your Chat screens
    }

    ChatComponentFactory can also be extended in a separate class and passed to the ChatTheme as shown:

    class MyChatComponentFactory : ChatComponentFactory {
        @Composable
        override fun RowScope.ChannelListHeaderTrailingContent(
            params: ChannelListHeaderTrailingContentParams,
        ) {
            IconButton(onClick = params.onHeaderActionClick) {
                Icon(
                    imageVector = Icons.Default.Add,
                    contentDescription = "Add",
                )
            }
        }
    }
    
    ChatTheme(
        componentFactory = MyComponentFactory()
    ) {
        // Your Chat screens
    }