# Hide or Replace Messages in a Chat Feed

Configure how each individual message in a chat feed is rendered in the Chat UI using custom logic and by extending the OverridableUI class.

Configure the `renderMode` function with your custom logic. This function is invoked per message to determine its UI representation, which can be hidden, default, or custom.

Using the sample code, set the `EntryRenderMode` enum value for each ChatFeedEntry of the ViewComponents interface.

- To hide a chat message, have your `renderMode` function return `EntryRenderMode.None` for that specific entry.
- To use the default built-in UI to display chat entries, set `EntryRenderMode.Existing`.
- To use a customized UI to display chat entries using the composable CustomEntryContainer, set `EntryRenderMode.Replace`.

```sfdocs-code {"lang":"kotlin", "title": "Hide or replace messages in a chat feed", "src": "" }

open class OverridableUI {
  open fun renderMode(entry: ChatFeedEntry): EntryRenderMode = EntryRenderMode.Existing
  inner class CustomViewComponents(private val conversationClient: ConversationClient) : ViewComponents {
    @Composable
    override fun ChatFeedEntry(entry: ChatFeedEntry, content: @Composable () -> Unit) {
      when (renderMode(entry)) {
        EntryRenderMode.None -> Unit
        EntryRenderMode.Existing -> content()
        EntryRenderMode.Replace -> CustomEntryContainer(entry, conversationClient)
      }
    }
  }
}
```

:::note
You must provide replacements for the entries that you replace. See the [​Sample Code for Defining Your Own UI for the Text Message Entry Type](/docs/service/messaging-in-app/guide/android-define-ui.md#sample-code-for-defining-your-own-ui-for-the-text-message-entry-type) and [Sample Code for Defining Your Own UI for the Choices message Entry Type​](/docs/service/messaging-in-app/guide/android-define-ui.md#sample-code-for-defining-your-own-ui-for-the-choices-message-entry-type) sections for examples.
:::
