Skip to content
Loom
Esc
↑↓navigate↵open⌘Jpreview
On this page

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" />
    </>
  );
}
PropType
side?"start" | "end"

The edge it docks to, following the writing direction.

Type"start" | "end"
Default"end"
width?number

Width in pixels on screens wide enough for it.

Typenumber
Default420
launcher?boolean

Shows a floating button that opens it.

Typeboolean
Defaultfalse
shortcut?string

Keyboard shortcut that toggles it, like `"mod+k"`: ⌘ on Apple platforms, Ctrl elsewhere.

Typestring
controller?LoomPanelController

Shares open state with your own triggers. Create one with `createLoomPanelController()`.

TypeLoomPanelController
open?boolean

Controls whether it's open.

Typeboolean
defaultOpen?boolean
Typeboolean
onOpenChange?(open: boolean) => void
Type(open: boolean) => void

Widget

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.

PropType
position?"bottom-right" | "bottom-left"

Corner for the launcher and the window.

Type"bottom-right" | "bottom-left"
Default"bottom-right"
launcher?boolean

Shows the floating launcher.

Typeboolean
Defaulttrue
icon?ReactNode

The launcher's icon.

TypeReactNode
shortcut?string

Keyboard shortcut that toggles it.

Typestring
controller?LoomWidgetController

Shares open state with your own triggers.

TypeLoomWidgetController
open?boolean
Typeboolean
defaultOpen?boolean
Typeboolean
onOpenChange?(open: boolean) => void
Type(open: boolean) => void

Inline

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 />} />