Installation
Install the MessageList component using the shadcn CLI:Usage
Props
UIMessage[]
required
Array of chat messages to display. Uses the standard UI message format from AI SDK.
ChatStatus
required
The current chat status. Controls loading indicators and UI states.
React.RefObject<HTMLDivElement>
required
Reference to the main scrollable container element.
React.RefObject<HTMLDivElement>
required
Reference to the last user message element for scroll positioning.
React.RefObject<HTMLDivElement>
required
Reference to the last assistant message element for scroll positioning.
React.RefObject<HTMLDivElement>
required
Reference to the bottom sentinel element used for scroll detection.
() => void
required
Function to scroll the list to the bottom.
boolean
required
Whether the user is currently scrolled to the bottom of the list.
number
Height of the chat container in pixels. Used for dynamic spacing calculations.
'user' | 'assistant'
The role of the last message in the list. Affects spacing calculations.

