Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Chat Scroll
  3. API and Development

Chat Scroll

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
PropTypeNotes
labelLocalizedMessageRequired. Names the log.
jumpToLatestLabelLocalizedMessageRequired. Accessible name when unreadCount is zero.
childrenReactNodeThe messages, oldest first, as plain children.
jumpUnreadLabel(count: number) => LocalizedMessageAccessible name when unreadCount is above zero.
unreadCountnumberMessages that arrived out of view. Caller-owned; not shown visually.
localestringBCP 47 locale for formatting in jumpUnreadLabel at the call site.
loadingRowReactNodeRow at the top while older messages load. Pauses onReachStart and silences the log.
errorRowReactNodeRow at the top when loading older messages failed. Pauses onReachStart and silences the log.
onReachStart() => voidThe start of the transcript scrolled into view.
onAtEndChange(atEnd: boolean, details: ChangeDetails<ChatScrollAtEndChangeReason>) => voidThe reader reached or left the latest message. Once per change after mount; not cancelable.
overlayReactNodeSits at the block end on a fade, such as a composer. It has its own row below the transcript, so the transcript ends where it starts and the jump control rises above it, with no measurement. Outside the log.
refRef<HTMLDivElement>The log element, which is the scroll root.
Native div attributes pass through to the log except style, tabIndex, className, role, aria-live, aria-relevant, aria-atomic, aria-label, aria-labelledby, layout props and on* handlers. data-* attributes, id and aria-describedby pass through.
Rendered structure
Exports
ChatScroll, ChatScrollProps, ChatScrollAtEndChangeReason from @prepared911/ui/chat-scroll.
Props
NameTypeDefaultDescription
jumpToLatestLabelLocalizedMessage—Accessible name of the jump-to-latest control when {@link ChatScrollLayoutProps.unreadCount} is zero. When the count is above zero, {@link ChatScrollLayoutProps.jumpUnreadLabel} names the control instead.
labelLocalizedMessage—Accessible name of the transcript. The log element is named by it.
aria-descriptionLocalizedMessage—Extended description for assistive tech.
aria-placeholderLocalizedMessage—Hint for an empty control.
childrenReactNode—The messages, oldest first, as plain children. ChatScroll renders them in one list inside the log and assumes nothing about a child beyond it being an element in that list.
errorRowReactNode—Row shown at the top of the transcript when loading older messages failed. Pauses onReachStart like loadingRow.
jumpUnreadLabel((count: number) => LocalizedMessage)—Accessible name when {@link ChatScrollLayoutProps.unreadCount} is above zero. Receives the count so copy can pluralize or format the number; the count is not shown visually.
loadingRowReactNode—Row shown at the top of the transcript while older messages load. Pauses {@link ChatScrollLayoutProps.onReachStart} and keeps the log quiet for assistive technology until it is removed. Remove it in the same update that adds the older messages.
localestring—BCP 47 locale for formatting numbers in jumpUnreadLabel at the call site. ChatScroll does not read this prop; it remains for callers who format the unread count in their label callback.
onAtEndChange((atEnd: boolean, details: ChangeDetails<ChangeReason.None>) => void)—Called when the reader moves to the latest message or away from it, once per change after mount. The transcript starts at the latest message. @param atEnd - True when the scroll offset is within a few pixels of the latest message @param details - Change metadata; the change cannot be canceled
onReachStart(() => void)—Called when the start of the transcript, where the oldest loaded message is, scrolls into view. Paused while loadingRow or errorRow renders, and reported again when the row is removed if the start is still visible.
overlayReactNode—Content that floats over the block end of the transcript, such as a composer. ChatScroll measures it, keeps that much room below the last message, and lifts the jump control above it. It fades into the surface above it, and only the slot itself takes pointer events. It is outside the log, so it is not announced as transcript.
refRef<HTMLDivElement>—Ref to the log element, which is the scroll root.
titleLocalizedMessage—Native tooltip; accessibility hint, not visible UI title text.
unreadCountnumber—How many messages arrived while the reader was away from the latest one. The caller owns the number; it is folded into the jump control's accessible name through jumpUnreadLabel when above zero. Reset it from {@link ChatScrollLayoutProps.onAtEndChange}.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Chat Scroll / Usage
Next
Chat Scroll / Accessibility
On this page
Rendered structure
Exports
Props
Storybook