Yogi Prasetya monogram logo
Skill Graph
Loading theme switcher

Chat Layout

A responsive three-column communication interface with conversation sidebar, message feed, and contact profile.

Interactive Playground

Explore the live three-column layout: switch conversations in the left sidebar, send messages in the active thread, and inspect channel or contact details in the profile sheet.

Installation

Add the Chat Layout block to your Next.js project via the shadcn CLI or manual file installation.

pnpm dlx shadcn@latest add https://yogiprasetya.com/r/chat.json

Usage

Import ChatLayout and mount it inside a height-constrained container.

app/chat/page.tsx
import { ChatLayout } from '@/components/chat/chat-layout';
import type { Message } from '@/components/chat/chat-types';

export function ChatPage() {
  const [messages, setMessages] = React.useState<Message[]>([]);

  const handleSend = (text: string) => {
    // Send message callback
  };

  return (
    <div className="h-screen w-full">
      <ChatLayout
        messages={messages}
        chatType="direct"
        onSend={handleSend}
      />
    </div>
  );
}

Composition

Internal structural decomposition and modular sub-component hierarchy.

  • ChatLayout
    • ChatSidebar
      • ChatConversationContact
    • ChatConversationHeader
    • ChatConversationArea
      • ChatMessageList
        • ChatMessageStatus
    • ChatComposer
    • ChatProfile

ChatLayoutProps

Complete API reference for properties accepted by the ChatLayout component.

PropTypeDefaultDescription
messagesrequired
Message[][]Array of thread messages to display in the conversation list.
onSendrequired
(text: string) => void—Callback triggered when user submits a message via composer.
activeChatType
'direct' | 'group''direct'Determines whether the chat behaves as 1-on-1 or multi-user channel.
hasMore
booleanfalseWhether more historical messages are available to load from the server.
onLoadMore
() => void—Callback triggered when user scrolls to top of message list to load older messages.
onRetry
(clientId: ClientId) => void—Callback triggered when user clicks retry on an error-state message.
sidebar
ChatLayoutProps["sidebar"]—Configuration for left conversation navigation list and active conversation selection.
profile
ChatLayoutProps["profile"]—Configuration for right contact sheet or group information panel.
presence
Presence—Typing indicators and presence status for the active conversation.
contact
CenterContactHeader—Header metadata for the central conversation panel.
centerAttachments
AttachmentItem[]—Static attachments forwarded to center column for preview rendering.
defaultProfileOpen
booleanfalseInitial open state for the collapsible profile column.
className
string—Optional CSS class name for outer layout container.
Build / Date
2026.09.27
Registry count
1 block
Deployed on
Vercel
License
MIT
Stack
Next.js 16·React 19·@base-ui/react·shadcn/ui·Tailwind CSS
Analytics
Vercel Web Analytics
Inspired by
shadcn/ui·Tailwind CSS