useChannelActionItems

Builds channel action items (mute, archive, leave, delete, etc.) for swipe rows and action sheets.

Best Practices

  • Use this hook as the source of truth for channel row actions.
  • Prefer getChannelActionItems to customize ordering/visibility instead of rebuilding defaults.
  • Keep custom action handlers async-safe and user-feedback friendly.
  • Distinguish direct chats vs group channels when customizing labels.
  • Keep destructive actions clearly separated from standard actions.

Usage

import { useChannelActionItems } from "stream-chat-react-native";

const actionItems = useChannelActionItems({
  channel,
  getChannelActionItems: ({ defaultItems }) =>
    defaultItems.filter((item) => item.id !== "archive"),
});

Surface-aware customization

Pass surface to indicate which UI is requesting the items. The value flows into context.surface inside your getChannelActionItems override so you can branch per surface, and the default builder uses it to tailor the item set (for example, the default pin/unpin item is excluded when surface is 'details').

import { useChannelActionItems } from "stream-chat-react-native";

const actionItems = useChannelActionItems({
  channel,
  surface: "details",
  getChannelActionItems: ({ defaultItems, context }) =>
    context.surface === "details"
      ? defaultItems.filter((item) => item.id !== "leave")
      : defaultItems,
});

surface is optional and back-compatible. When omitted, no surface-specific filtering is applied and the hook returns every item the default builder would otherwise produce.

Parameters

NameTypeRequiredDescription
channelChannelYesChannel used to compute available actions.
surfaceChannelActionSurface ('list' | 'details')NoIdentifies which top-level UI is requesting the items. Forwarded to context.surface inside getChannelActionItems. When omitted, no surface filtering is applied.
getChannelActionItemsGetChannelActionItemsNoOptional transformer for default action items. Receives { defaultItems, context }; context.surface reflects the value passed to the hook.

Returns

TypeDescription
ChannelActionItem[]Ordered action definitions for channel UI controls.