Docs · Chat Prompt Layout

Chat Prompt Layout

A full-height chat layout with scrollable messages and a bottom-anchored prompt slot, including contextual scroll navigation buttons. Independently installable.

Install

npm package
import { ChatPromptLayout } from 'prompt-area'
shadcn registry
import { ChatPromptLayout } from '@/components/chat-prompt-layout'

Example

Chat layout

Messages scroll independently while the prompt area stays anchored at the bottom. Scroll navigation buttons appear contextually.

Hey, can you help me understand how React Server Components work?
Sure! React Server Components (RSC) let you render components on the server. They can directly access backend resources like databases and file systems without an API layer. The key difference from traditional SSR is that RSC never ship their JavaScript to the client — they render once on the server and send HTML.
How do they differ from Client Components?
Client Components are the traditional React components you're used to. They run in the browser, can use hooks like useState and useEffect, and handle interactivity. You mark them with "use client" at the top. Server Components are the default in Next.js App Router — they can't use browser APIs or hooks, but they reduce the JavaScript bundle sent to the client.
Can I mix them together?
Absolutely! That's the whole idea. You can import Client Components into Server Components. The Server Component handles data fetching and layout, while Client Components handle interactive parts. Think of it as a tree where Server Components are the branches and Client Components are the interactive leaves.
What about data fetching patterns?
In Server Components, you can use async/await directly — just make the component async and fetch data at the top level. No need for useEffect or state management for server data. For Client Components, you can pass data as props from a parent Server Component, or use traditional patterns like SWR or React Query for client-side fetching.
That makes a lot of sense. What about caching?
Next.js extends fetch with automatic caching and revalidation. You can set cache behavior per-request with options like { cache: "force-cache" } or { next: { revalidate: 60 } }. There's also the unstable_cache API for caching non-fetch operations like database queries. The App Router also has built-in route segment caching.