Browse API 1 documentation
grove.channelBadges.set()
Replace native badges beside joined channels.
Replace native badges beside joined channels.
Signature
grove.channelBadges.set(badges: {
id: string; channelKey: string;
icon?: string; text?: string; tooltip?: string
color?: 'neutral' | 'accent' | 'success' | 'warning' | 'danger'
}[]): void
Availability
Server-scoped runtimes with ui.channel-badges. Reading authoritative target data requires the corresponding channel.members or channel.metadata capability separately.
Parameters
| Parameter | Required | Description |
|---|---|---|
badges |
Yes | Full replacement array; [] clears all. |
id |
Yes | Local badge identity per target; trimmed/lowercased, capped at 64 characters, nonempty. |
channelKey |
Yes | Host-canonical channel key; nonempty, at most 200 UTF-8 bytes. |
icon |
At least icon or text | SF Symbol name, single-line and capped at 64 characters. |
text |
At least icon or text | Single-line label, capped at 32 characters. |
tooltip |
No | Single-line explanation, capped at 120 characters. |
color |
No | Semantic tint, default neutral; unknown values use neutral. |
Return value
Returns undefined; no validation report or list is returned.
Behavior and errors
The call replaces the whole list atomically. Mango retains at most two badges per target per instance and 8,192 total, inspecting at most 32,768 candidates. Duplicate target/id entries keep the first. Empty/unrenderable entries are omitted. Use canonical keys from snapshots instead of lowercasing display names yourself. Rendering requires the target to exist; registrations grant no access to a missing roster. Mango provides attribution and removes contributions when the instance stops.
Example
grove.on('channelSnapshots', ({ channels }) => {
grove.channelBadges.set(channels.map(channel => ({
id: 'mode', channelKey: channel.channelKey,
text: channel.modes.join('') || 'none', color: 'neutral'
})))
})
See Event reference.