Skip to main content

UI Components

Beyond the base providers, the UI Kit exposes several standalone UI Components. These functional elements are utilized internally but exported explicitly so you can reuse them when building custom views.


<Avatar />

A versatile graphic component that handles profile image rendering, fallback initials processing, and uniform sizing.

Props

PropTypeDescription
imagestring | nullProfile image URL.
namestringString for initial fallbacks.
sizenumberDimension in pixels (Default 36).
classNamestringCustom CSS injection.
disableLightboxbooleanPrevent the image from opening in a full-screen lightbox on click.

Example

If an image is passed as null or fails to load, <Avatar /> handles gracefully extracting initials from the name prompt automatically.

import { Avatar } from '@ermis-network/ermis-chat-react';

export const UserListing = ({ user }) => (
<div className="flex items-center space-x-2">
<Avatar
image={user.avatarUrl} // Passes null properly
name={user.fullName || "Anonymous"}
size={40}
className="shadow-sm border border-gray-100"
/>
<span>{user.fullName}</span>
</div>
);

<ChannelHeader />

A preset layout element placed atop the channel container, displaying the active channel metadata.

Props

PropTypeDescription
titlestringContextual title text.
imagestringChannel image mapping.
subtitlestringMinor contextual strings.
renderRight(channel: Channel) => React.ReactNodeAnchor rightward nodes.
renderTitle(channel: Channel) => React.ReactNodeBypass central views.
AvatarComponentReact.ComponentType<AvatarProps>Override left graphic.
classNamestringAdjust boundary styles.
showOnlineStatusbooleanShow online/offline indicator for direct friend channels (default: true).
onlineLabelstringI18n label for "Online" subtitle.
offlineLabelstringI18n label for "Offline" subtitle.
OnlineIndicatorComponentReact.ComponentType<{ isOnline: boolean }>Custom online indicator component.

Example

import { ChannelHeader } from '@ermis-network/ermis-chat-react';

export const CustomHeader = ({ channel }) => (
<ChannelHeader
subtitle={`${Object.keys(channel.state.members).length} members online`}
renderRight={() => <button className="video-call-btn w-6 h-6">📹</button>}
/>
);

<MediaLightbox />

A standalone component for viewing images and videos in a full-screen interactive lightbox. Includes zoom, panning, and secure authenticated file downloading.

Props

PropTypeDescription
itemsMediaLightboxItem[]Array of media objects ({ type: 'image' | 'video', src, alt, posterSrc }).
initialIndexnumberStarting index when opened.
isOpenbooleanWhether the lightbox is visible.
onClose() => voidEvent triggered to close the lightbox.

<TypingIndicator />

An animated float tracking keystrokes within the group. Mounted at the timeline floor.

(Internal Note: State resolves via VirtualMessageList linking useTypingIndicator unless used manually).

Props

PropTypeDescription
renderText(users: TypingUser[]) => React.ReactNodeReplaces standard maps.

Example

import { TypingIndicator } from '@ermis-network/ermis-chat-react';

export const CustomIndicatorBox = () => (
<TypingIndicator
renderText={(users) => {
if (users.length === 0) return null;
return <span className="text-gray-400 italic">Someone is typing...</span>;
}}
/>
);

<PinnedMessages />

A sticky header panel mounting pinned message arrays.

Props

PropTypeDescription
classNamestringFramework layout variable.
onClickMessage(messageId: string) => voidEvent mapping jumps.
maxCollapsednumberLimit before grouping.
PinnedMessageItemComponentReact.ComponentType<PinnedMessageItemProps>Individual row element.
AvatarComponentReact.ComponentType<AvatarProps>Override profile icon.

<ReadReceipts />

A mini status list reflecting user read arrays. Contains floating context labels.

Props

PropTypeDescription
readersReadReceiptUser[]User state references.
maxAvatarsnumberTruncation cutoff number.
showTooltipbooleanActivates hover popup.
AvatarComponentReact.ComponentType<AvatarProps>Visual element format.
TooltipComponentReact.ComponentType<ReadReceiptsTooltipProps>Interface element logic.
isOwnMessagebooleanValidates target structure.
isLastInGroupbooleanConstraints logic bound.
statusstringTransmit log variable.

<MessageSearchPanel />

A heavy-duty layout menu designed to securely query entire channel arrays.

Core Modal Props

PropTypeDescription
isOpenbooleanConditional render boundary.
onClose() => voidUnmounts visual hierarchy.
channelChannelExact timeline contexts.
debounceMsnumberFrame metric limiting HTTP queries (Default 500).

Layout Props

PropTypeDescription
AvatarComponentReact.ComponentType<AvatarProps>Override visual template.
titlestringTop bar title.
placeholderstringInput box hint.
loadingTextstringLoading prompt logic.
emptyTextstringMiss alert boundary.

Example

import { MessageSearchPanel, useChannel } from '@ermis-network/ermis-chat-react';

export const SearchManager = ({ isSearchOpen, closeSearch }) => {
const { channel } = useChannel();

if (!channel) return null;

return (
<MessageSearchPanel
isOpen={isSearchOpen}
onClose={closeSearch}
channel={channel}
title="Search Conversation"
emptyText="No exact messages matched this query."
/>
);
};

<ChannelSettingsPanel />

The central modular control board wrapping configurations cleanly.

Props

PropTypeDescription
isOpenbooleanNode tracking visibility.
onClose() => voidRemoval execution callback.
channelChannelOverrides native context.
titlestringHeader string block.
slowModeOptions{ label: string, value: number }[]Rate cap mapping.

Example

import { ChannelSettingsPanel, useChannel } from '@ermis-network/ermis-chat-react';

export const SettingsManager = ({ isSettingsOpen, closeSettings }) => {
const { channel } = useChannel();

if (!channel) return null;

return (
<ChannelSettingsPanel
isOpen={isSettingsOpen}
onClose={closeSettings}
channel={channel}
title="Room Preferences"
slowModeOptions={[
{ label: 'Off', value: 0 },
{ label: '5s delay', value: 5 },
{ label: '1m delay', value: 60 }
]}
/>
);
};

<UserPicker />

A versatile, virtualized list component for searching and selecting users. Supports single (radio) and multiple (checkbox) selection modes, local-first search with remote fallback, and infinite scrolling.

Props

PropTypeDescription
mode'radio' | 'checkbox'Selection mode.
onSelectionChange(users: UserPickerUser[]) => voidCallback when selection updates.
excludeUserIdsstring[]Array of user IDs to show as disabled.
initialSelectedUsersUserPickerUser[]Users pre-selected on component mount.
pageSizenumberItems per page for infinite scroll (Default 30).
AvatarComponentReact.ComponentTypeOverride avatar visual.
searchPlaceholderstringPlaceholder for search input.
selectedEmptyLabelstringText to show in checkbox mode when no users are selected.

Example

import { UserPicker } from '@ermis-network/ermis-chat-react';
import { useState } from 'react';

export const AddMembersPanel = ({ existingMemberIds }) => {
const [selected, setSelected] = useState([]);

return (
<div className="h-96">
<UserPicker
mode="checkbox"
excludeUserIds={existingMemberIds}
onSelectionChange={(users) => setSelected(users)}
searchPlaceholder="Type a name or email..."
selectedEmptyLabel="Select users to add..."
/>
</div>
);
};