CommentsThread

Record-attached threaded discussion. Reads a comments sub-resource via useGetList, filtered by the parent record's id. Renders one card per comment plus a new-comment textarea.

Installation

pnpm dlx shadcn@latest add @shadmin/comments-thread

Usage

import { CommentsThread, Show } from "@/components/admin";
 
const PostShow = () => (
  <Show>
    <CommentsThread reference="comments" target="parentId" resolvable />
  </Show>
);

Comment record shape

interface Comment {
  id: string | number;
  parentId: string | number;
  authorId: string;
  authorName?: string;
  body: string;
  createdAt: string; // ISO timestamp
  resolvedAt?: string | null;
}

Props

PropRequiredTypeDefaultDescription
referenceRequiredstring-Comments sub-resource name
targetRequiredstring-Field on comment that holds parent id
resolvableOptionalbooleanfalseShow "Mark resolved" button per comment

Required parent context

<CommentsThread> must be rendered inside a <RecordContextProvider> (e.g. inside <Show> or <Edit>).