Split-panel chat interface with a collapsible secondary panel for artifacts, previews, or tools.
Overview
A responsive two-panel layout where the main chat occupies the primary space and a secondary panel (for artifacts, code previews, etc.) slides in when needed. On mobile, the secondary panel replaces the main panel. Composable shadcn-style primitives.How it works
The layout usesreact-resizable-panels wrapped in composable components:
| Component | Purpose |
|---|---|
ChatLayout | Root container with sidebar-aware max-width |
ChatLayoutMain | Primary panel, hides on mobile when secondary is visible |
ChatLayoutHandle | Drag handle between panels |
ChatLayoutSecondary | Conditional panel, renders only when visible |
isSecondaryPanelVisible prop on ChatLayout. This value is shared to child components through React context, so they automatically show/hide based on the state.
Code
Components
components/chat/chat-layout.tsx
Usage
components/chat.tsx