App, comment thread


Install
npx shadcn add @klarhimmel/app-comments-threadDetailsAbout, usage, props and more
A discussion between people: comments with author and time, replies one level deep, a Reply button that opens a form under its comment (focus moves in and back), and a…
Import
Import
- app/comments-thread
- About
- A discussion between people: comments with author and time, replies one level deep, a Reply button that opens a form under its comment (focus moves in and back), and a composer.
- Category
- Interface sections for signed-in products. New project? Set it up once: /get-started/installation.
Notes
When to use it
A discussion under a record: comments with replies one level deep and a field to write a new one. For a conversation with an assistant use app-assistant-thread; for a notification feed use app-notifications-inbox.
Writing for it
- Use 1 to 4 top-level comments with up to 3 replies each. Give every comment an author and time so the replies make sense without extra context.
- replyLabel (20) is followed by the author's name for screen readers, so use just Reply rather than Reply to this comment.
- composer.empty (80) is shown when someone posts an empty field. Say what to write, not that the field is invalid.
Watch out for
What a person posts lives only in this block and is not saved, and it starts over when the thread props change. Replies cannot be nested further, so a reply form on a reply is not offered.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Discussion' | Text, up to 60 characters. Optional; empty is not rendered. |
title | string | 'Name the discussion' | Text, up to 120 characters. |
description | string | 'Say who can see this.' | Text, up to 300 characters. Optional; empty is not rendered. |
summaryWord | string | 'comments' | Text, up to 20 characters. |
comments | { author, time, body, replies }[] | 1 item | List of 1 to 4. Each item: author, time, body, replies. |
replyLabel | string | 'Reply' | Text, up to 20 characters. |
replyForm | { label, submit, cancel } | {…} | Fields: label, submit, cancel. |
composer | { label, submit, posting, empty } | {…} | Fields: label, submit, posting, empty. |
you | string | 'You' | Text, up to 24 characters. |
justNow | string | 'just now' | Text, up to 24 characters. |
notices | { posted, replied } | {…} | Fields: posted, replied. |
state | 'filled' | 'empty' | 'posting' | 'error' | 'filled' | One of 'filled', 'empty', 'posting', 'error'. |
messages | { emptyTitle, emptyBody, error } | {…} | Fields: emptyTitle, emptyBody, error. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |