Skip to content
GitHub (opens in a new tab)

CommentsPanel

A side panel that holds a page's comment threads, with an Open / Resolved / All filter.

stableOrganismcontracts/commentspanel.json

Preview

CommentsPanel

A side panel hosting a page's comment threads.

Master

The button opens the Drawer; the inline panel below works the same and docks beside a page; the page sets its width. Open a thread, Resolve it, or go back to All threads. On a phone, Close, Back and Resolve grow to md (36).

2 open

Usage

CommentsPanel lists threads with an Open / Resolved / All filter and hosts the selected thread: pass a CommentThread (without a title) as children. It opens in a kit Drawer from its trigger; inline renders it in place.

Do's

  • a page (invoice, document) has several comment threads
  • people filter open and resolved threads and open one
  • a header needs a Comments button with the open count
  • a page docks its threads beside the content on wide screens (inline="auto")

Don'ts

  • one conversation on its own — CommentThread
  • product notifications — NotificationStack
  • agent work — AgentInbox
<CommentsPanel
  threads={threads}
  open={open}
  onOpenChange={setOpen}
  selectedId={selected}
  onSelect={setSelected}
  onResolve={resolve}
>
  <CommentThread comments={comments} value={draft} onValueChange={setDraft} onSubmit={post} />
</CommentsPanel>

A side panel hosting the comment threads for a page: an Open / Resolved / All filter, thread previews, and the selected thread (pass a kit CommentThread as children) with Resolve. Built on kit Drawer and SegmentedControl; inline renders it in place, and inline="auto" docks it beside the page from --grid-breakpoint-lg.

When to use

  • a page (invoice, document) has several comment threads
  • people filter open and resolved threads and open one
  • a header needs a Comments button with the open count
  • a page docks its threads beside the content on wide screens (inline="auto")

When not to use

  • one conversation on its own — CommentThread
  • product notifications — NotificationStack
  • agent work — AgentInbox

What an agent reads

import { CommentsPanel } from "agentic-ds-kit";
must
  • the trigger is a kit Button described by the open count Badge
  • the panel is the kit Drawer dialog (focus trap, Escape closes, focus returns to the trigger); inline or docked it is a complementary region labelled by label, and closing a docked auto panel returns focus to the trigger
  • the filter is a kit SegmentedControl radio group
  • threads are buttons; resolved threads say so to screen readers; the open thread says "INV-1842 · 3 comments · Open" in words
  • All threads (ghost) returns focus to the thread that was opened; below --grid-breakpoint-sm it reads "Threads"
  • below --grid-breakpoint-sm Close, All threads and Resolve grow to md (36) for touch
  • list and thread crossfade on opacity, off under prefers-reduced-motion
defaults
  • filter open
  • label Comments
  • emptyTitle No comments yet
  • inline false
  • showTrigger true
  • loading false
stops if
  • Do not invent a local CommentsDrawer or ThreadList
  • Do not re-implement the thread: pass a CommentThread as children
  • Do not use Tabs for the Open / Resolved / All filter
  • Do not use raw hex

From contracts/commentspanel.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
threadsarrayYes—{ id, title, preview, count, resolved?, updatedAt, context? }[]. context names the record (e.g. "INV-1842 · Northwind") and leads the open thread's meta line: "INV-1842 · 3 comments · Open". Use one date format for updatedAt, e.g. "Nov 20, 10:26".
openbooleanYes——
onOpenChangefunctionYes——
selectedIdstringNo——
onSelectfunctionYes—(id | null) => void; null goes back to the list.
onResolvefunctionNo——
filteropen | resolved | allNoopen—
onFilterChangefunctionNo——
childrenReactNodeNo—The selected thread, usually a CommentThread without a title.
composerReactNodeNo—Shown under the list, e.g. a page-level CommentThread.
labelstringNoComments—
emptyTitlestringNoNo comments yet—
emptyDescriptionstringNo——
inlineboolean | "auto"Nofalsetrue renders the panel in place. "auto" docks it beside the page from --grid-breakpoint-lg while open (the trigger comes back when it closes) and uses the Drawer below that.
showTriggerbooleanNotrue—
loadingbooleanNofalse—
errorstringNo——
onRetryfunctionNo——
  • Component
    →

    CommentThread

    One conversation on a document, invoice or task: comments, one level of replies, @mentions shown as brand text, in-place edit and delete for your own comments (in a More menu), and a composer.

  • Component
    →

    NotificationStack

    The durable in-app inbox of product notifications: an sm bell with the unread count opens a 24rem kit Popover (a full-height Drawer below --grid-breakpoint-sm) with the list, Mark all read and View all.

  • Component
    →

    AgentInbox

    A queue of what agents need from you: approvals, questions, failed runs and finished recaps.

  • Component
    →

    Drawer

    Edge panel for secondary tasks.