Chats by Today, Yesterday and earlier, with search, pinning, projects, rename in place, share and delete.
Pinned
Projects
Today
Yesterday
Previous 7 days
Previous 30 days
September
2025
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { ConversationList } from "./ui/uicontext/components/chat/ConversationList.ts"import { ConversationSummary } from "./ui/uicontext/components/domain/Chat.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, radius, space } from "./ui/uicontext/components/tokens.stylex.ts"import { chatList, chatNow, chatProjects } from "./ai-chat.ts"const Message = UiSchema.TaggedEnum({ RenamedChat: { id: Schema.String, title: Schema.String }, PinnedChat: { id: Schema.String, pinned: Schema.Boolean }, MovedChat: { id: Schema.String, project: Schema.NullOr(Schema.String) }, DeletedChat: { id: Schema.String },})const styles = stylex.create({ frame: { display: "flex", flexDirection: "column", inlineSize: "min(100%, 17rem)", blockSize: "34rem", padding: space.md, borderRadius: radius.lg, backgroundColor: color.raised, boxShadow: `inset 0 0 0 1px ${color.line}` },})export const ChatSidebarDemo = Html.component({ name: "ChatSidebarDemo", model: Schema.Struct({ chats: Schema.Array(ConversationSummary) }), message: Message,}).make({ init: () => ({ chats: chatList }), update: { RenamedChat: ($, { id, title }) => $.evolve({ chats: (all) => all.map((c) => (c.id === id ? { ...c, title } : c)) }), PinnedChat: ($, { id, pinned }) => $.evolve({ chats: (all) => all.map((c) => (c.id === id ? { ...c, pinned } : c)) }), MovedChat: ($, { id, project }) => $.evolve({ chats: (all) => all.map((c) => (c.id === id ? { ...c, project } : c)) }), DeletedChat: ($, { id }) => $.evolve({ chats: (all) => all.filter((c) => c.id !== id) }), }, view: (h, model) => h.div.attrs(sx(styles.frame)).children( ConversationList(h, { props: { conversations: model.chats, projects: chatProjects, now: chatNow, current: "webhooks", href: "#:id", timeZone: "UTC" }, onEmit: { RequestedRename: ({ id, title }) => Message.RenamedChat({ id, title }), RequestedPin: ({ id, pinned }) => Message.PinnedChat({ id, pinned }), RequestedMove: ({ id, project }) => Message.MovedChat({ id, project }), RequestedShare: () => undefined, RequestedDelete: ({ id }) => Message.DeletedChat({ id }), }, }), ),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/conversation-listUsage
import { ConversationList } from "./ui/uicontext/components/chat/ConversationList.ts"import type { ChatProject, ConversationSummary } from "./ui/uicontext/components/domain/Chat.ts"const Message = UiSchema.TaggedEnum({ RenamedChat: { id: Schema.String, title: Schema.String }, PinnedChat: { id: Schema.String, pinned: Schema.Boolean }, MovedChat: { id: Schema.String, project: Schema.NullOr(Schema.String) }, SharedChat: { id: Schema.String }, DeletedChat: { id: Schema.String },})// apply each change to your list at once, and offer Undo for a deleteexport const Chats = (h: Html.H<typeof Message.Type>, chats: ReadonlyArray<ConversationSummary>, projects: ReadonlyArray<ChatProject>, now: string, current?: string) => ConversationList(h, { props: { conversations: chats, projects, now, href: "/c/:id", ...(current === undefined ? {} : { current }) }, onEmit: { RequestedRename: ({ id, title }) => Message.RenamedChat({ id, title }), RequestedPin: ({ id, pinned }) => Message.PinnedChat({ id, pinned }), RequestedMove: ({ id, project }) => Message.MovedChat({ id, project }), RequestedShare: ({ id }) => Message.SharedChat({ id }), RequestedDelete: ({ id }) => Message.DeletedChat({ id }), }, })Examples
Before the first chat
A new account has nothing to list yet, and the list says where chats will appear.
No chats yet. Your conversations show up here.
import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { ConversationList } from "./ui/uicontext/components/chat/ConversationList.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"import { chatNow } from "./ai-chat.ts"const styles = stylex.create({ frame: { display: "flex", flexDirection: "column", inlineSize: "min(100%, 17rem)", blockSize: "12rem", padding: space.md } })export const EmptyChatList = Html.component({ name: "EmptyChatList", model: Schema.Struct({}), message: Schema.Never }).make({ init: () => ({}), update: ($) => $.model, view: (h) => h.div.attrs(sx(styles.frame)).children( ConversationList(h, { props: { conversations: [], now: chatNow, href: "#:id" }, onEmit: { RequestedRename: () => undefined, RequestedPin: () => undefined, RequestedMove: () => undefined, RequestedShare: () => undefined, RequestedDelete: () => undefined }, }), ),})API reference
Props
| Name | Type | Description |
|---|---|---|
conversationsrequired | ConversationSummary[] | — |
projects | ChatProject[] | — |
current | string | The open conversation's id |
nowrequired | string | The present, ISO, for the date groups; the app's clock, never read here |
hrefrequired | string | A conversation's link, with :id where its id goes: "/c/:id" |
timeZone | string | The time zone the date groups follow; the reader's own when left out |
agentId | string | The id agents see this list by |
Events
| Event | Payload | Description |
|---|---|---|
RequestedRename | { id: string; title: string } | — |
RequestedPin | { id: string; pinned: boolean } | — |
RequestedMove | { id: string; project: string | null } | File it under project, or take it out of any with null |
RequestedShare | { id: string } | — |
RequestedDelete | { id: string } | — |
Agent actions
| Action | Description |
|---|---|
ChangedQuery | Search the chats by title |
PickedRowAction | Rename (pass title), pin, unpin, share or delete a chat by its id |