Skip to content
synccn

Conversation

New

Scrolling chat area that sticks to the bottom while answers stream, pauses when you scroll up, and jumps back down.

What's the difference between useMemo and useCallback?

Assistant

useMemo caches a value; useCallback caches a function. useCallback(fn, deps) is the same as useMemo(() => fn, deps).

Installation

$ pnpm dlx shadcn@latest add @synccn/conversation

First time in this project? Connect synccn with one command.

Usage

import { Conversation } from "@/components/ui/conversation";<Conversation className="flex-1" empty={<PromptSuggestions … />}>{messages}</Conversation>

API reference

Generated from the component's TypeScript types, so it always matches the code.

Conversation

Scrolling message list for chat: sticks to the bottom as answers stream in, stops when the person scrolls up to read, and shows a button to jump back down.

  • children
    React.ReactNode

    Messages.

  • follow
    boolean

    Default true

    Keeps the newest message in view while the person is at the bottom, including while it streams.

  • empty
    React.ReactNode

    Shown when there are no children, such as suggestions.

  • aria-label
    string

    Accessible name.

  • className
    string

    Extra classes for the root element. Give it a height (h-96, flex-1…); the messages scroll inside it.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

  • The message list is a log region, so new messages are announced. A button to jump to the latest message appears when you scroll up.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: log
  • ARIA attributes: aria-label, aria-relevant