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
Run this command in your Tailwind CSS project. It adds
components/ai/session-tabs-strip.tsxand installs its dependencies.$ npx shadcn@latest add https://gradientdeck.com/ai-components/r/session-tabs-strip.json
Usage & API
Example
import { SessionTabStrip } from "@/components/ai/session-tabs-strip"
<SessionTabStrip
tabs={[]}
activeId={null}
onSelect={() => {}}
onClose={() => {}}
onNew={() => {}}
onReorder={() => {}}
/>Props SessionTabStrip
| Prop | Type & description | Required |
|---|---|---|
tabs | SessionTab[] | Required |
activeId | string | null | Required |
onSelect | (id: string) => void | Required |
onClose | (id: string) => void | Required |
onNew | () => void | Required |
onReorder | (tabs: SessionTab[]) => void | Required |
onReopen | () => voidReopens the most recently closed tab. Hidden when not provided. | Optional |
canReopen | boolean | Optional |
newTabShortcut | string | Optional |
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.
Example
import { SessionColumn } from "@/components/ai/session-tabs-stacked"
<SessionColumn
sessions={[]}
activeId={null}
onSelect={() => {}}
onTogglePin={() => {}}
onClose={() => {}}
onNew={() => {}}
collapsed={true}
onCollapsedChange={() => {}}
/>Props SessionColumn
| Prop | Type & description | Required |
|---|---|---|
sessions | StackedSession[] | Required |
activeId | string | null | Required |
onSelect | (id: string) => void | Required |
onTogglePin | (id: string) => void | Required |
onClose | (id: string) => void | Required |
onNew | () => void | Required |
collapsed | boolean | Required |
onCollapsedChange | (collapsed: boolean) => void | Required |
Dependencies
- React
- Tailwind CSS
- motion
- lucide-react
Implementation notes
The column is headed New session. Sessions split into Pinned and Open. Each row can be pinned or unpinned and closed. A running session shows Working. Collapsing the column leaves a narrow switcher. The empty column says No open sessions, and the empty thread says Start a session, with a note that running sessions keep going while you are in another one. A switcher menu can change the active session without expanding the column.
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.