shadcn.io is not affiliated with official shadcn/ui
Floating Widget Chat Block for Svelte
A chat launcher on a store page: a drawn shop with six products, a round launcher with an unread count and a teaser, and a chat panel that opens, closes on Escape and returns focus.
Installation
Overview
Show the chat launcher where visitors meet it, on the page, with this floating widget chat for Svelte with Ark UI. A hairline frame with a plus mark on each corner holds a window of fixed height drawn as the store itself: a title bar for Brightcombe, a clothing shop, and a grid of six drawn products that are decoration only. At the bottom end a round Button opens a 22 rem chat panel with a header, three bubbles and the composer; it turns into "Close chat" and reports aria-expanded and aria-controls. The panel is open on load. Escape inside it closes it and returns focus to the launcher. Close it before writing and, two seconds later, a short line arrives: the launcher shows an unread count and a teaser bubble ("Need help choosing a size?"), and opening clears the count. Messages are Message and Bubble rows. The composer's Shine Button, the only colored control, sends what you type; Enter sends and Shift and Enter add a line. The frame is ruled by Guides, and everything moves with CSS only. Not a docs page with a minimise loop: the page is the stage.
FAQ
What stays in the page, and how do I make it real?
Everything. The shop, the replies and the proactive line are typed in the file, and nothing is sent. To wire it for real, mount the panel on your own pages, send messages where post is, and trigger the teaser from your own rule, such as time on a product page.
How does the launcher work?
It is a button with a name that changes between "Open chat" (with the unread count when there is one) and "Close chat", and it reports whether the panel is open and which element it controls. The count is a small badge hidden from assistive technology, because the name already says it.
What happens on Escape?
Escape anywhere inside the open panel closes it and puts focus back on the launcher, so a keyboard user returns to where they were. The closed panel is hidden and inert, but its messages and your draft are kept.