Panel dock

A resizable panel docked beside or under the chat for files, previews and sources, which collapses out of the way.

Loading preview…

Install

  1. 1

    Run this command in your Tailwind CSS project. It adds components/ai/panel-dock-side.tsx and installs its dependencies.

    $ npx shadcn@latest add https://gradientdeck.com/ai-components/r/panel-dock-side.json

Usage & API

Example

panel-dock-side.tsx
import { SidePanelDock } from "@/components/ai/panel-dock-side"

<SidePanelDock
  children={children}
  tabs={[]}
  activeTab="…"
  onTabChange={() => {}}
  panel={panel}
  width={1}
  onWidthChange={() => {}}
  collapsed={true}
  onCollapsedChange={() => {}}
  sheetOpen={true}
  onSheetOpenChange={() => {}}
/>

Props SidePanelDock

PropType & descriptionRequired
childrenReactNodeThe main area, usually the chat.Required
tabsDockTab[]Required
activeTabstringRequired
onTabChange(id: string) => voidRequired
panelReactNodeContent for the active tab.Required
widthnumberRequired
onWidthChange(width: number) => voidRequired
collapsedbooleanRequired
onCollapsedChange(collapsed: boolean) => voidRequired
sheetOpenbooleanBelow the md breakpoint the panel opens as a bottom sheet instead.Required
onSheetOpenChange(open: boolean) => voidRequired
defaultWidthnumberOptional
minWidthnumberOptional
maxWidthnumberOptional
minMainWidthnumberRoom the main area always keeps, in px.Optional
actionsReactNodeExtra buttons in the panel header, before the collapse button.Optional
labelstringOptional

Dependencies

  • React
  • Tailwind CSS
  • motion
  • lucide-react
Implementation notes

The side dock sits on the right of the chat. A resize handle changes the width. Collapse panel hides it, Expand panel brings it back, and on a small screen Open and Close panel run the sheet. Tabs can show a count. The preview's panel is a document preview with Reload preview, a preview-width control, and a sources list. The composer asks for a change. The header names the page being discussed. Dragging stops at the minimums you set, so the thread never shrinks to nothing.

Choosing a layout

Use the side dock when the extra material is read beside the thread, a preview or a source, and should become a sheet on a narrow window. Use the bottom dock when the extra material is a log or a file list that people expect under the work, and when a one-line summary is enough while it is collapsed.

Several chats open at once are session tabs. A single cited page with the quote highlighted is the source viewer. The dock is the frame those tools can sit in. It does not page through quotes or keep session state.

Does the dock decide what the Files or Preview tab contains?

No. You pass the tabs and the panel for the active one. The preview happens to show a preview and sources on the side, and files, a terminal and steps on the bottom. Another screen can pass different tabs without changing the dock.

Where does the side panel go on a narrow window?

It stops being a column. sheetOpen controls a bottom sheet, with Open and Close panel. The width you stored is for the column, when there is room for it beside the thread.