- Implementation
- ChatWindow API
Common Examples
Copy
Ask AI
import { ChatWindow } from "@servicetitan/ext-atlas";
function BasicChatWindow() {
const [open, setOpen] = useState(false);
return (
<ChatWindow open={open}>
{/* Header, Content, Footer components */}
</ChatWindow>
);
}
With Position
Use theposition prop to create a floating chat window at specific coordinates:Copy
Ask AI
import { ChatWindow } from "@servicetitan/ext-atlas";
function PositionedChatWindow() {
const [open, setOpen] = useState(true);
return (
<ChatWindow
open={open}
position={{ x: 100, y: 64 }}
>
{/* Chat content */}
</ChatWindow>
);
}
Draggable Window
Combine with theuseDraggable hook to create a draggable chat window:Copy
Ask AI
import { ChatWindow, Header, useDraggable } from "@servicetitan/ext-atlas";
function DraggableChatWindow() {
const [open, setOpen] = useState(true);
const { position, isDragging, handleMouseDown, resetPosition } = useDraggable();
return (
<ChatWindow
open={open}
position={position}
isDragging={isDragging}
>
<Header
title="Atlas"
isDraggable
isDragging={isDragging}
onMouseDown={handleMouseDown}
onClose={() => setOpen(false)}
/>
{/* Content and Footer */}
</ChatWindow>
);
}
Fullscreen Mode
Enable fullscreen mode for an expanded chat experience:Copy
Ask AI
import { ChatWindow } from "@servicetitan/ext-atlas";
function FullscreenChatWindow() {
const [open, setOpen] = useState(true);
const [fullscreen, setFullscreen] = useState(false);
return (
<ChatWindow
open={open}
fullscreen={fullscreen}
>
<Header
title="Atlas"
isExpanded={fullscreen}
onFullscreen={() => setFullscreen(!fullscreen)}
onClose={() => setOpen(false)}
/>
{/* Content and Footer */}
</ChatWindow>
);
}
Copy
Ask AI
<ChatWindow
open={true}
position={{ x: 100, y: 64 }}
isDragging={false}
fullscreen={false}
>
{children}
</ChatWindow>
ChatWindow Props
The content to render inside the chat window, typically Header, Content, and Footer components.
Controls whether the chat window is visible. Triggers open/close animations.
When true, the window expands to fill the available space with a fade animation instead of the standard slide animation.
Indicates if the window is currently being dragged. When true, layout animations are disabled to prevent conflicts.
Optional coordinates for positioning the chat window. When provided, the window uses absolute positioning.
