Session tabs

Several chats open at once as tabs, with the ones still running marked, so you can switch without losing your place.

Loading preview…

Install

  1. 1

    Run this command in your Tailwind CSS project. It adds components/ai/session-tabs-strip.tsx and installs its dependencies.

    $ npx shadcn@latest add https://gradientdeck.com/ai-components/r/session-tabs-strip.json

Usage & API

Example

session-tabs-strip.tsx
import { SessionTabStrip } from "@/components/ai/session-tabs-strip"

<SessionTabStrip
  tabs={[]}
  activeId={null}
  onSelect={() => {}}
  onClose={() => {}}
  onNew={() => {}}
  onReorder={() => {}}
/>

Props SessionTabStrip

PropType & descriptionRequired
tabsSessionTab[]Required
activeIdstring | nullRequired
onSelect(id: string) => voidRequired
onClose(id: string) => voidRequired
onNew() => voidRequired
onReorder(tabs: SessionTab[]) => voidRequired
onReopen() => voidReopens the most recently closed tab. Hidden when not provided.Optional
canReopenbooleanOptional
newTabShortcutstringOptional

Dependencies

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

The strip shows one tab per open chat, with a close button and a status treatment for a chat that is still running. Overflow goes to a menu labeled as all tabs, with a search field whose placeholder is Search open tabs, and the current tab marked Current. New chat sits at the end of the row. Reopen closed tab appears when a closed tab can come back. Tabs can be reordered. With nothing open, the thread area says What are you working on, or No open chats once the last one is closed, and reminds you that closed tabs stay in history.

Choosing a layout

Use the strip when the chat is the whole window and the open threads are peers along the top, the way a browser keeps pages. Use the column when the list should stay visible, with pinned threads separated from the rest, and when collapsing it should give the thread the width back.

A panel beside the chat for files, a preview or sources is the panel dock, not another session. A list of agent runs waiting on a person is the agent inbox. Session tabs are only the open conversations, including the ones still writing.

Does closing a tab stop a running reply?

Closing only calls onClose with the session id. The column's empty copy says a running session keeps going while you are away. Stopping a reply is the stop button in the preview's composer, which is separate from the tab.

Can the person reopen a tab they just closed?

On the strip, yes, if you pass onReopen and say a closed tab can be reopened. The menu item is Reopen closed tab. The column does not have that item. It has pin, close and new session.