NexusUI

Thread

AI chats 2

About

A scrollable chat message container that automatically sticks to the bottom as new messages arrive and shows a jump-to-bottom button when the user scrolls up.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Thread to your project and fits it to your theme.

Code

How Thread is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  Thread,
  ThreadContent,
  ThreadScrollToBottom,
} from "@/components/ui/thread";

export default function ThreadDemo() {
  return (
    <div className="w-full h-[500px] rounded-xl border border-border overflow-hidden bg-background">
      <Thread>
        <ThreadContent>
          {Array.from({ length: 10 }).map((_, i) =>
            i % 2 === 0 ? (
              <div
                key={i}
                className="ml-auto max-w-[80%] rounded-full bg-muted px-4 py-2 text-sm text-foreground"
              >
                Message {i + 1}: This is a sample chat message used to
                demonstrate the scrollable thread.
              </div>
            ) : (
              <div
                key={i}
                className="max-w-[80%] text-sm leading-relaxed text-foreground"
              >
                Message {i + 1}: This is a sample chat message used to
                demonstrate the scrollable thread.
              </div>
            ),
          )}
        </ThreadContent>
        <ThreadScrollToBottom />
      </Thread>
    </div>
  );
}

Dependencies

More by NexusUI

View all
  • Circular Carousel

    Circular Carousel

    1.3K
  • Images Badge

    Images Badge

    990
  • Chat Messages

    Chat Messages

    337
  • Cinematic Logo Cloud

    Cinematic Logo Cloud

    164
  • Infinite Moving Cards

    Infinite Moving Cards

    161
  • Shooting Stars Grid

    Shooting Stars Grid

    159
  • Logo Clouds

    Logo Clouds

    110
  • Image Trail

    Image Trail

    94

More in AI chats

View all
  • AI Actions

    AI Actions

    333
  • AI Task List

    AI Task List

    177
  • Color Picker

    Color Picker

    143
  • Illos Knowledge Sources

    Illos Knowledge Sources

    17
  • Source Lens

    Source Lens

    6
  • Attachments

    Attachments

    29
  • Code Block

    Code Block

    13
  • Streaming Text

    Streaming Text

    21