Chat Container

A component for creating chat interfaces with intelligent auto-scrolling behavior, designed to provide a smooth experience in conversation interfaces.

Hello! Can you help me with a coding question?
AI

Of course! I'd be happy to help with your coding question. What would you like to know?

How do I create a responsive layout with CSS Grid?
AI

Creating a responsive layout with CSS Grid is straightforward. Here's a basic example:

css
.container {  display: grid;  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));  gap: 1rem;}

This creates a grid where:

  • Columns automatically fit as many as possible
  • Each column is at least 250px wide
  • Columns expand to fill available space
  • There's a 1rem gap between items

Would you like me to explain more about how this works?

Installation

pnpm dlx shadcn-svelte@latest add https://svelte-ai-elements.vercel.app/p/chat-container.json

Examples

Streaming Example

Hello! Can you help me with a coding question?
AI

Of course! I'd be happy to help with your coding question. What would you like to know?

How do I create a responsive layout with CSS Grid?
AI

Creating a responsive layout with CSS Grid is straightforward. Here's a basic example:

css
.container {  display: grid;  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));  gap: 1rem;}

This creates a grid where:

  • Columns automatically fit as many as possible
  • Each column is at least 250px wide
  • Columns expand to fill available space
  • There's a 1rem gap between items

Would you like me to explain more about how this works?

Props

ChatContainer Root

NameTypeDefault
children
Snippet
className
string
...props
HTMLAttributes<HTMLDivElement>

ChatContainer Content

NameTypeDefault
children
Snippet
className
string
...props
HTMLAttributes<HTMLDivElement>

ChatContainer Scroll Anchor

NameTypeDefault
className
string
...props
HTMLAttributes<HTMLDivElement>