Layouts
Put the agent beside your product, over it, inside a page, or as a page of its own.
Each layout wraps a thread and takes all of its props, so chat, title, empty, tools and labels work the same everywhere.
| Layout | Item | Use it for |
|---|---|---|
LoomPanel |
panel |
A panel docked to the side, beside the page |
LoomWidget |
widget |
A floating window from a corner launcher |
LoomInline |
inline |
A card inside a page |
LoomPage |
page |
The agent as the whole page |
Panel
Docked to the end of the page (the right, in left-to-right languages). The page stays usable while it’s open, and on phones it can be swiped away.
npx shadcn@latest add https://loom.mkhonta.com/r/panel.json
"use client";
import { LoomPanel, LoomPanelTrigger, createLoomPanelController } from "@/components/loom/panel";
import { useLoomEve } from "@/lib/loom/eve";
import { useState } from "react";
export function Assistant() {
const chat = useLoomEve({ agent: "support" });
const [panel] = useState(createLoomPanelController);
return (
<>
<LoomPanelTrigger controller={panel}>Ask support</LoomPanelTrigger>
<LoomPanel chat={chat} controller={panel} shortcut="mod+k" />
</>
);
}
side?"start" | "end"
The edge it docks to, following the writing direction.
"start" | "end""end"width?number
Width in pixels on screens wide enough for it.
number420launcher?boolean
Shows a floating button that opens it.
booleanfalseshortcut?string
Keyboard shortcut that toggles it, like `"mod+k"`: ⌘ on Apple platforms, Ctrl elsewhere.
stringcontroller?LoomPanelController
Shares open state with your own triggers. Create one with `createLoomPanelController()`.
LoomPanelControlleropen?boolean
Controls whether it's open.
booleandefaultOpen?boolean
booleanonOpenChange?(open: boolean) => void
(open: boolean) => voidWidget
A floating window above the page, opened from a launcher in the corner. It stays open while people use the page behind it, keeps its conversation while closed, and becomes a sheet on small touch screens.
npx shadcn@latest add https://loom.mkhonta.com/r/widget.json
<LoomWidget chat={chat} position="bottom-right" shortcut="mod+j" />
To open it from your own button as well, share a controller the same way as the panel’s: createLoomWidgetController() and LoomWidgetTrigger. Set launcher={false} to open it only from your own buttons.
position?"bottom-right" | "bottom-left"
Corner for the launcher and the window.
"bottom-right" | "bottom-left""bottom-right"launcher?boolean
Shows the floating launcher.
booleantrueicon?ReactNode
The launcher's icon.
ReactNodeshortcut?string
Keyboard shortcut that toggles it.
stringcontroller?LoomWidgetController
Shares open state with your own triggers.
LoomWidgetControlleropen?boolean
booleandefaultOpen?boolean
booleanonOpenChange?(open: boolean) => void
(open: boolean) => voidInline
The agent in a card of its own, for a help page, a dashboard tile or a modal. It’s 600px tall by default; set the height with className.
<LoomInline chat={chat} className="h-[480px]" />
Page
The agent as the whole page, with past conversations beside it. It fills its container, so give that the height. The sidebar hides on small screens.
Pass sessions and the sidebar is a session list with those props:
<div className="h-dvh">
<LoomPage
chat={chat}
sessions={{ sessions, currentId, onSelect: setCurrentId, onNew: () => setCurrentId(undefined) }}
/>
</div>
For a sidebar of your own, pass sidebar instead:
<LoomPage chat={chat} sidebar={<Projects />} />
