shadcn.io is not affiliated with official shadcn/ui
Chat With History AI Block for Svelte
An assistant window whose Sidebar lists past chats under Pinned, Today and Last week with a search field, where you can open, pin, rename in place and delete a chat, and any typed request gets a scripted reply in the chat that is open.
Installation
Overview
Let people come back to earlier conversations, with this AI chat with history for Svelte with Ark UI. A hairline frame with a plus mark on each corner holds a window of fixed height for Pastbrook, a long-memory assistant. The catalog Sidebar lists six past chats in three groups, Pinned, Today and Last week, under a search field and an outline New chat button; choosing one loads its thread of Message and Bubble rows, your turns in a quiet bubble and the assistant's as plain prose behind a tile. The top bar holds what you can do to the open chat: pin it, rename it in place (Enter saves, Escape cancels) or delete it behind an Alert Dialog with Cancel first. A new chat opens empty with three sample requests. The composer's Shine Button, the only colored control, sends; a Typing Indicator Text comes first, the reply arrives in pieces, and Stop takes Send's place while it writes. The frame is ruled by Guides, and everything moves with CSS only. It's the starting point for a chat product that remembers.
FAQ
What stays in the page, and how do I make it real?
Everything. The six chats, their groups and the replies are typed at the top of the file, and the replies come from a short keyed script plus two fallbacks, as the line under the window says. Pinning, renaming, deleting and new chats change local state and are gone on reload. To wire it, load the list from your API into chats, save a rename, pin and delete where saveRename, pin and remove change state, and send the request in post where the comment says to.
Where are rename, pin and delete?
In the top bar, for the chat that is open, so the rail stays a clean list and the actions work the same on a phone. Pin toggles a pressed button and moves the chat to the Pinned group; Rename swaps the title for a field in the same place (the bar does not change size) with Save and Cancel; Delete asks first, names the chat, and falls back to the first remaining chat, or to a fresh empty one if you delete the last.
How does search work, and what if nothing matches?
The field filters the rail as you type, matching the chat titles anywhere in the word, and empty groups hide. When nothing matches, a short note names what you typed and a Clear search button restores the list. Opening a chat or starting a new one also clears the search.
What happens if I open another chat while a reply is being written?
The reply keeps going and lands in the chat it was asked in, so switching never loses or moves a message. While one reply is being written, Send is replaced by Stop; Stop keeps what has been written so far and marks it Stopped.
Is it usable with a keyboard and a screen reader?
Tab runs the rail, the top bar, the log and the composer. Every chat link names its title and says "pinned" when it is, the open one is marked current, and each message starts with a hidden "You, 09:42" or "Pastbrook, 09:42". The log is a focusable region announced as a log; one polite status line says what changed. When the dialog closes, focus goes to the composer.