> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reaction List

> Who reacted to a message, under a strip of emoji tabs, with removal of your own reaction.

`CometChatReactionList` shows who reacted to a message: a strip of tabs — "All" with the
total first, then one per emoji with its count — over the people who reacted. Your own row
reads "You" with "Tap to remove" under it; tapping it removes your reaction. The
[message list](https://www.cometchat.com/docs/ui-kit/ios/v6/message-list.md) opens it as a half-height sheet when you
long-press a reaction under a bubble.

![CometChatReactionList showing reaction tabs and the users who reacted](https://mintcdn.com/cometchat-22654f5b/pWDsskjSUHgot30F/images/ui-kit/ios/v6/docs-overview-reaction-list.png?fit=max\&auto=format\&n=pWDsskjSUHgot30F\&q=85\&s=260db84aa1a7492c38725db632c35559)

***

## Where It Fits

```
CometChatMessageList
        │ long-press a reaction under a bubble
        ▼
┌────────────────────────────────┐
│ CometChatReactionList ← here   │   a .medium sheet with a grabber
└────────────────────────────────┘
        │ tap your own row → the reaction is removed
        │ the last reaction gone → onEmpty → dismiss
```

***

## Quick Start

Give it the message and dismiss it when the last reaction is gone:

> [tab] SwiftUI
>
> ```swift theme={null}
> struct ReactionsSheetHost: View {
>     let message: BaseMessage
>     @State private var showsReactions = false
>
>     var body: some View {
>         Button("Reactions") { showsReactions = true }
>             .sheet(isPresented: $showsReactions) {
>                 CometChatReactionList(baseMessage: message, onEmpty: { showsReactions = false })
>                     .presentationDetents([.medium])
>                     .presentationDragIndicator(.visible)
>             }
>     }
> }
> ```
>
> The sheet's material and corner radius are the system's — Liquid Glass on iOS 26, an opaque
> `background1` on iOS 18–25.

> [tab] UIKit
>
> ```swift theme={null}
> final class ReactionsPresenter: UIViewController {
>     func showReactions(for message: BaseMessage) {
>         let list = CometChatReactionList()
>             .set(message: message)
>             .set(onEmpty: { [weak self] in self?.dismiss(animated: true) })
>         if let sheet = list.sheetPresentationController {
>             sheet.detents = [.medium()]
>             sheet.prefersGrabberVisible = true
>         }
>         present(list, animated: true)
>     }
> }
> ```
>
> `CometChatReactionList` is a `UIViewController`. The sheet's corner radius and material are
> the system's — Liquid Glass on iOS 26, the opaque `background1` content on iOS 18–25. The
> list loads in `viewDidLoad`, never earlier; a setter never loads the view.

***

## Behaviour

> [tab] SwiftUI
>
> * The sheet **opens on All**. Pass `selectedReaction` to open on an emoji's tab instead.
> * Tapping a tab moves the underline. The rows do **not** change until you scroll to the end
>   of the list, which loads that tab's next page.
> * The next page loads whenever the last row appears.
> * Tapping **your own** row removes your reaction, then calls `onItemClick`. Tapping anyone
>   else's row only calls `onItemClick`. A failed removal leaves the row in place, silently.
> * Reactions by other people while the sheet is open do not update it.
> * `onEmpty` fires once when the last reaction is gone; `onError` each time a fetch fails.

> [tab] UIKit
>
> * The sheet **opens on All**. `set(defaultReaction:)` opens on an emoji's tab instead.
> * Tapping a tab moves the underline; the rows change only when you scroll to the end, which
>   loads that tab's next page.
> * The next page loads whenever the last row is displayed.
> * Tapping **your own** row removes your reaction, **then** calls `set(onClick:)` and the
>   delegate. A failed removal leaves the row in place, silently.
> * Reactions by other people while the sheet is open do not update it.

***

## Actions and Events

### Callback Methods

> [tab] SwiftUI
>
> | Prop | Signature | When |
> | - | - | - |
> | `onItemClick` | `(Reaction, BaseMessage) -> Void` | a row is tapped |
> | `onEmpty` | `() -> Void` | the last reaction is gone — dismiss |
> | `onError` | `(CometChatError) -> Void` | a fetch fails |
>
> ```swift theme={null}
> struct ReactionsWithCallbacks: View {
>     let message: BaseMessage
>
>     var body: some View {
>         CometChatReactionList(
>             baseMessage: message,
>             reactionsRequestBuilder: ReactionsRequestBuilder().set(limit: 20),
>             onItemClick: { reaction, message in print(reaction.uid, message.id) },
>             onError: { error in print(error.code) })
>     }
> }
> ```

> [tab] UIKit
>
> | Setter | Delegate | Called |
> | - | - | - |
> | `set(onClick:)` | `onReactionListItemClick(reaction:message:)` | a row was tapped |
> | `set(onEmpty:)` | `onEmpty()` | the last reaction is gone — dismiss |
> | `set(onError:)` | `onError(error:)` | a fetch failed |
>
> ```swift theme={null}
> final class ReactionsObserver: NSObject, CometChatReactionListDelegate {
>     func onReactionListItemClick(reaction: Reaction, message: BaseMessage) {
>         print(reaction.uid, message.id)
>     }
>     func onError(error: NSError) { print(error.localizedDescription) }
> }
> ```

### SDK Events (Real-Time, Automatic)

The sheet does not update while it is open: reactions by other people do not change it.

***

## Functionality

> [tab] SwiftUI
>
> | Prop | Type | Default |
> | - | - | - |
> | `baseMessage` | `BaseMessage` | required |
> | `store` | `CometChatReactionListStore?` | `nil` |
> | `reactionsRequestBuilder` | `ReactionsRequestBuilder?` | `nil` |
> | `selectedReaction` | `String?` | `nil` — opens on All |
> | `style` | `CometChatReactionListStyle` | |
> | `hideSeparator` | `Bool` | `true` |
> | `hideLoadingState`, `hideErrorState` | `Bool` | `false` |
> | `errorText` | `String?` | `nil` |
> | `imageSource` | `any ImageSource` | |

> [tab] UIKit
>
> | Method or property | Type | Does |
> | - | - | - |
> | `set(message:)` | `BaseMessage` | the message whose reactions are listed |
> | `set(reactionRequestBuilder:)` | `ReactionsRequestBuilder` | the request for each tab's pages |
> | `set(defaultReaction:)` | `String` | the emoji tab to open on |
> | `set(store:)` | `CometChatReactionListStore` | the store the sheet reads |
> | `disableLoadingState`, `disableErrorState` | `Bool` | show nothing in those states; `false` by default |
> | `hideSeparator` | `Bool` | `true` by default; `false` draws a line between rows |
> | `set(errorStateText:)` | `String?` | the error text |
> | `style`, `avatarStyle`, `set(listItemStyle:)`, `set(configuration:)` | | see Style and Configuration |

***

## States

> [tab] SwiftUI
>
> | State | Shows | Hide with |
> | - | - | - |
> | loading | ten shimmer rows under the strip | `hideLoadingState` |
> | content | the rows; an empty page is an empty list | — |
> | error | "Looks like something went wrong. Please try again." over the rows | `hideErrorState` |
> | empty | nothing — the host dismisses on `onEmpty` | — |
>
> The strip and its separator stay in every state. `errorText` replaces the error text.

> [tab] UIKit
>
> `disableLoadingState` and `disableErrorState` show nothing in those states. The line under
> the strip always draws. The host dismisses the sheet on `onEmpty`; the sheet does not dismiss
> itself.

***

## Custom View Slots

> [tab] SwiftUI
>
> Every slot is a parameter and a cascading modifier; an initialiser argument wins. A row slot
> receives the Kit's `ReactedUser` — `name`, `emoji`, `avatarURL` and `isMe`:
>
> ```swift theme={null}
> struct CustomRows: View {
>     let message: BaseMessage
>
>     var body: some View {
>         CometChatReactionList(
>             baseMessage: message,
>             trailingView: { user in AnyView(Text(user.emoji).font(.largeTitle)) })
>             .cometChatReactionListSubtitleView { user in
>                 Text(user.isMe ? "Tap to remove" : user.uid).font(.caption)
>             }
>     }
> }
> ```
>
> | Slot | Replaces | Modifier |
> | - | - | - |
> | `itemView` | the whole row, kept tappable | `.cometChatReactionListItemView` |
> | `leadingView` | the avatar | `.cometChatReactionListLeadingView` |
> | `titleView` | the name | `.cometChatReactionListTitleView` |
> | `subtitleView` | the line under the name | `.cometChatReactionListSubtitleView` |
> | `trailingView` | the emoji | `.cometChatReactionListTrailingView` |
> | `loadingView` | the shimmer | `.cometChatReactionListLoadingView` |
> | `errorView` | the error text | `.cometChatReactionListErrorView` |
>
> Hide parts of every reaction list in a subtree:
>
> ```swift theme={null}
> MyAppRoot().cometChatReactionListHidden([.loadingState])
> ```

> [tab] UIKit
>
> The row slots receive the SDK's `Reaction`:
>
> ```swift theme={null}
> let list = CometChatReactionList()
> list.set(tailView: { reaction in
>         let label = UILabel()
>         label.text = reaction.reaction
>         label.font = .systemFont(ofSize: 28)
>         return label
>     })
>     .set(subtitleView: { reaction in
>         let label = UILabel()
>         label.text = reaction.reactedBy?.name
>         return label
>     })
>     .set(loadingStateView: MySpinner())
>     .set(errorStateText: "Reactions are unavailable right now.")
> ```
>
> `set(listItemView:)` replaces the whole row and keeps it tappable; `set(leadingView:)`,
> `set(titleView:)`, `set(subtitleView:)` and `set(tailView:)` replace the avatar, the name,
> the line under it and the emoji. `set(loadingStateView:)` and `set(errorStateView:)` replace
> the shimmer and the error state.

***

## Advanced Methods

### Store Access

> [tab] SwiftUI
>
> `CometChatReactionListStore` holds the tabs, the rows and the state. Each list makes its own;
> pass one to observe it, or a seeded one to preview without a session:
>
> ```swift theme={null}
> #Preview {
>     CometChatReactionList(
>         baseMessage: TextMessage(receiverUid: "group-1", text: "Hi", receiverType: .group),
>         store: CometChatReactionListStore(seeded: .content,
>                                           tabs: [ReactionTab(id: ReactionTab.allKey, count: 1, reactedByMe: false),
>                                                  ReactionTab(id: "👍", count: 1, reactedByMe: false)],
>                                           users: [ReactedUser(id: "r1", uid: "andrew", name: "Andrew Joseph",
>                                                               avatarURL: nil, emoji: "👍", reactedAt: .now,
>                                                               isMe: false)]))
> }
> ```
>
> A seeded store never fetches or removes. Set `policy.pageLimit` on a store to change the
> page size when no builder is given.

> [tab] UIKit
>
> `set(store:)` replaces the store the sheet reads.

### Configuration

> [tab] SwiftUI
>
> Pass the style and the request builder directly: see `style` and `reactionsRequestBuilder`
> under Functionality.

> [tab] UIKit
>
> `ReactionListConfiguration` bundles the setters, and the message list hands it to the sheet
> it opens. All seven are honoured:
>
> ```swift theme={null}
> let style = ReactionListStyle()
> style.reactionTabActiveIndicatorColor = .systemOrange
>
> let configuration = ReactionListConfiguration()
>     .set(style: style)
>     .set(reactionRequestBuilder: ReactionsRequestBuilder().set(limit: 20))
>     .set(onTappedToRemoveClicked: { reaction, message in print(reaction.reaction) })
>
> let list = CometChatReactionList().set(configuration: configuration)
> ```

### Subclassing

> [tab] SwiftUI
>
> `CometChatReactionList` is a `View` struct. Customise it with its slots, modifiers and style.

> [tab] UIKit
>
> These methods are the override points:
>
> | Method | Called |
> | - | - |
> | `viewDidLoad()` | builds, starts the store, loads the first page |
> | `viewWillAppear(_:)` | applies the style again |
> | `buildUI()` | once, to build the strip, the line and the rows |
> | `setupStyle()` | at load, on appear, and when `style` is assigned |
> | `showLoadingView()` / `hideLoadingView()` | entering and leaving loading |
> | `addErrorView()` | entering the error state |
> | `reloadData()` | to redraw the strip and the rows |
>
> ```swift theme={null}
> final class TitledReactionList: CometChatReactionList {
>     override func buildUI() {
>         super.buildUI()
>         title = "Reactions"
>     }
> }
> ```
>
> `listItemCellClass` and `tabCellClass` take a subclass of `CometChatReactionListItem` or
> `ReactionListTabCell`.

***

## Accessibility

* Each tab is a button that reads "*emoji*, *count* reactions", marked selected when active.
* Each row reads "*name*, *emoji*", plus "Tap to remove" on yours.
* The shimmer reads "Loading reactions, please wait".

> [tab] SwiftUI
>
> Rows built with a slot are read as the slot draws them.

> [tab] UIKit
>
> A row with a custom view stops being one element so the view can be found.

***

## Style

> [tab] SwiftUI
>
> `CometChatReactionListStyle` is sparse: set only what you change.
>
> | Property | Default |
> | - | - |
> | `backgroundColor` | `background1` |
> | `tabTextColor`, `tabTextActiveColor`, `tabTextStyle` | `textSecondary`, `textHighlight`, `bodyMedium` |
> | `tabActiveIndicatorColor` | `primary` — the 3 pt bar |
> | `tabBackgroundColor` | clear |
> | `separatorColor`, `separatorHeight` | `strokeDefault`, 1 — the line under the strip |
> | `errorTextColor`, `errorTextStyle` | `textSecondary`, `bodyRegular` |
> | `itemStyle` | the rows — title `bodyMedium`, subtitle `caption1Regular`, emoji `heading2Regular`, a 32 pt avatar, separators `strokeLight` |
> | `shimmerStyle` | the shimmer — `background4` / `background3` |
> | `strokeColor`, `strokeWidth`, `cornerRadius`, `itemStyle.backgroundColor` | have no effect |
>
> ```swift theme={null}
> struct StyledReactions: View {
>     let message: BaseMessage
>
>     var body: some View {
>         var style = CometChatReactionListStyle()
>         style.tabActiveIndicatorColor = .orange
>         style.itemStyle = CometChatReactionListItemStyle(titleTextColor: .indigo)
>         return CometChatReactionList(baseMessage: message, style: style, hideSeparator: false)
>     }
> }
> ```

> [tab] UIKit
>
> The statics are the defaults every list created **afterwards** copies:
>
> ```swift theme={null}
> CometChatReactionList.style.reactionActiveTabTextColor = .systemIndigo
> CometChatReactionList.avatarStyle.backgroundColor = .systemTeal
> ```
>
> For one list:
>
> ```swift theme={null}
> let style = ReactionListStyle()
> style.titleTextFont = .preferredFont(forTextStyle: .headline)
> style.separatorColor = .separator
>
> let list = CometChatReactionList()
> list.style = style
> ```
>
> `ReactionListStyle` follows `CometChatUIKitTheme` for any property you leave unset.
>
> | Property | Default |
> | - | - |
> | `backgroundColor` | `background1` |
> | `cornerRadius`, `borderWidth`, `borderColor` | 0, 0, `strokeLight` — the content view; never the sheet |
> | `titleTextFont`, `titleTextColor` | `bodyMedium`, `textPrimary` |
> | `subTitleTextFont`, `subTitleTextColor` | `caption1Regular`, `textSecondary` |
> | `tailViewTextFont`, `tailViewTextColor` | `heading2Regular`, `textPrimary` |
> | `reactionTabTextFont`, `reactionTabTextColor`, `reactionActiveTabTextColor` | `bodyMedium`, `textSecondary`, `textHighlight` |
> | `reactionTabBackgroundColor`, `reactionTabActiveIndicatorColor` | clear, `primary` |
> | `separatorColor`, `separatorHeight` | `strokeDefault`, 1 |
> | `errorTextColor`, `errorTextFont` | `textSecondary`, `bodyRegular` |
> | `avatarStyle` | not applied — set the controller's `avatarStyle` |
>
> `set(listItemStyle:)` takes a `ReactionListItemStyle` and wins over the row fields above.

***

## Next Steps

> [card] [Message List](https://www.cometchat.com/docs/ui-kit/ios/v6/message-list.md)
>
> Opens the sheet from a long-press on a reaction

> [card] [Message Information](https://www.cometchat.com/docs/ui-kit/ios/v6/message-information.md)
>
> Delivery and read details for a message

> [card] [Component Styling](https://www.cometchat.com/docs/ui-kit/ios/v6/component-styling.md)
>
> Style every component


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.