Skip to content

UseChatScrollReturn

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:531

Properties

hasNewMessages

hasNewMessages: boolean

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:546

Whether there are new messages below the current scroll position


isAtBottom

isAtBottom: boolean

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:544

Whether the user is currently scrolled to the bottom


scrollContainerRef

scrollContainerRef: RefObject<HTMLDivElement | null>

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:533

Ref to attach to the scrollable container element


scrollContentRef

scrollContentRef: RefObject<HTMLDivElement | null>

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:542

Ref for the element whose height changes trigger auto-scroll.

Attach this to the inner content element (the one that grows when messages stream in). The hook observes its resize events so the list stays pinned to the bottom during streaming, even when the messages array length does not change.


scrollTo()

scrollTo: (options) => void

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:553

Scroll the container to an arbitrary position. Thin wrapper over Element.scrollTo.

Parameters

options

ScrollToOptions

Returns

void


scrollToBottom()

scrollToBottom: (behavior?) => void

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:548

Programmatically scroll to the bottom

Parameters

behavior?

ScrollBehavior

Returns

void


scrollToElement()

scrollToElement: (el, options?) => void

Defined in: src/components/editor/ChatPanel/ChatPanel.types.ts:558

Scroll a specific element into view inside the container. Thin wrapper over Element.scrollIntoView.

Parameters

el

HTMLElement

options?

ScrollIntoViewOptions

Returns

void