useChatToggle
function useChatToggle(options): {
mergedProps: ChatToggleButtonProps;
};Defined in: packages/react/src/hooks/chat/useChatToggle.ts:44
The useChatToggle hook provides state and functions for toggling the chat window.
Parameters
| Parameter | Type |
|---|---|
options | UseChatToggleOptions |
Returns
{
mergedProps: ChatToggleButtonProps;
}mergedProps
mergedProps: ChatToggleButtonProps;Example
// Basic — merge chat-toggle props into a button.
const { mergedProps } = useChatToggle({ props: { "aria-label": "Toggle chat" } });
// Advanced — wire a custom chat toggle beside chat content.
function ChatToggleButton() {
const { mergedProps } = useChatToggle({
props: { className: "chat-toggle", "aria-label": "Toggle chat" },
});
return (
<VoiceRoom agent={agent}>
<button {...mergedProps}>Chat</button>
<RoomAudioRenderer />
</VoiceRoom>
);
}