Comments thread
A discussion on a record: replies one level deep, @mentions, sending with Retry, delete with Undo, and resolve.
Sending and Retry
Return a promise from onReply and the comment shows at once, dimmed with a spinner, until it arrives incomments (same author, parent and text); then it takes the row's place without fading in again. A rejection leaves it with "Not sent", Retry, which gets focus, and Discard. In the demo, turn on Fail next send, then send a comment: it fails once, and Retry goes through.
Other teams
Any record can carry a thread: a sales director agrees a discount on a deal and @mentions the account executive, a designer and a copywriter go over a campaign draft, and customer care leaves the warehouse an internal note on an order. That note is for the team only; a conversation with the customer is a support inbox, not this component.
Deleting with Undo
Delete never asks. The comment goes at once (a root with its replies), focus moves to the next comment or the composer, and a toast offers Undo with a countdown. onDelete runs only when that toast closes without Undo, or at once if the thread unmounts or the page is left first, so your API never deletes what was undone. Undo puts the comment back with focus on it; a rejected onDelete brings it back with an error toast. The toasts need the app's<Toaster />. Delete shows on your own comments, and on everyone's with moderator, in the ⋯ menu. Edit sits next to Reply on your own comments, which say "(me)" after your name.
Mentions
With mentions, "@" in the composer opens the Prompt bar's menu of the people search finds; it can return a promise. The composer is a Satin Textarea that takes that menu through its underlay, so a mention is a token in the text, removed whole with Backspace. onReply and onEdit get the mentions with their place in the body, and a comment's mentions are drawn as Free's Mention where the body reads "@" and the name. Hover or focus one and a tooltip shows the person's avatar and full name: the mention'savatar, else that of an author with the same id in comments, else their initials. A person picked from search with an avatar sends it with the mention.
Formatting
A comment's body is markdown-lite: **bold**, _italic_,~~struck~~, `code`, [text](https://…) and lines starting- as a bulleted list. Links go only to http, https and mailto addresses; any other shows its text alone, and no HTML is ever drawn from a body. The composer's toolbar (Bold, Italic, Code, Bulleted list, Link, and ⌘B, ⌘I, ⌘E, ⌘K in the field, Ctrl off Apple) writes those marks round the selection with the field's own editing, so undo takes them back and a mention is never split. The text stays plain, so onReply stores it as it is, mentions and all.
Agents
An author with kind: 'agent' takes the agent mark at rest in a circle, as in the Activity timeline, and an "Agent" badge after the name, so it is both seen and said. In the demo the hiring assistant drafts the offer letter and the recruiter answers it; in Sales, a deal assistant flags the discount policy.
Resolve
resolvable puts Resolve at the start of the composer's row, away from Send. A resolved thread folds to one line, "Resolved by Marta Nowak", with Show comments and Reopen; it fades, it doesn't change height. Leave it uncontrolled (defaultResolved, and the resolver is currentUser) or control it with resolved,onResolve and resolvedBy. In the demo, resolve the thread once the offer is accepted.
Parts
For a thread of your own, the pieces are exported: Comment (one article, with state="sending"or "failed", actions and footer), CommentComposer (the field and Send, with mentions) and CommentActions (the ⋯ menu; the thread puts only Delete in it).
Installation
npm i @uisatin/ui @uisatin/proimport '@uisatin/ui/styles.css'
import '@uisatin/pro/styles.css'
import { CommentsThread, type CommentItem } from '@uisatin/pro/comments-thread'Part of Satin Pro, the licensed edition: @uisatin/pro on top of @uisatin/ui at the same version, its stylesheet after Free's. Satin Pro isn't on npm yet.
About 13.0 kB of JavaScript, minified and gzipped, on top of the @uisatin/uicomponents it uses (React aside).
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The CommentsThread component (Satin Pro, @uisatin/pro/comments-thread) is a discussion on a record (a candidate, a deal, a campaign, an order), not a support inbox and not a change history. It is a div holding a List (ul, named "Comments") of threads: each root comment with its replies one level deep under it, then the composer. Each item of comments is { id, author: { id, name, avatar, kind }, body, at, edited, parentId, mentions }, oldest first; a reply to a reply joins its root and a reply whose parent is missing becomes a root. A comment is an <article> named "Comment by Marta Nowak, {full date}": avatar (initials in a tone from the author's id, or author.avatar; with kind: 'agent' the agent mark in a circle and an "Agent" Badge after the name), name, Free's RelativeTime, "(edited)", and the body with its line breaks, its mentions ({ id, label, start, end, avatar, kind }, where body.slice(start, end) is "@" and the label) drawn as Free's Mention with a tooltip of the avatar and full name on hover and focus (the mention's avatar, else that of an author with its id, else initials). The body is markdown-lite: **bold** or __bold__, _italic_ or *italic*, ~~struck~~, ` code , [text](url) (http, https and mailto only; any other shows its text) and lines starting - or * as a bulleted list; no HTML is ever rendered. Only roots have Reply; replies hang off a thread line under the root's avatar. Your own comments say "(me)" after your name and show Edit next to Reply. title puts a heading over the thread ("Comments") with the number of comments in a Badge, and names the thread as a region (titleAs sets the level, h3 by default); variant="card" sets it on a card. The composer is a 72px Satin Textarea with the Prompt bar's @ menu in its underlay (mentions.search, which can return a promise; a person found with an avatar sends it on the mention) and a formatting toolbar (Bold, Italic, Code, Bulleted list, Link; ⌘/Ctrl+B, I, E, K in the field) that writes those marks round the selection through the field's own undo, never splitting a mention; Ctrl/⌘+Enter sends and Enter is a new line. onReply(parentId, body, mentions) returning a promise sends optimistically: a dimmed row with a Spinner until a comment by currentUser with the same parent and body arrives in comments, which takes the row's place; a rejection leaves "Not sent" with Retry and Discard. Edit (onEdit) edits in place, optimistic until the body changes; a rejection reopens the editor with an error. The ⋯ menu holds Delete, on yours or anyone's with moderator. Delete never asks: the comment goes at once and a toast offers Undo with a countdown; onDelete(id) runs when the toast closes without Undo, or at once on unmount or pagehide, and a rejection brings the comment back with an error toast, so the app needs a <Toaster />. resolvable adds Resolve at the start of the composer's row; a resolved thread folds to one line ("Resolved by …", Show comments, Reopen), opacity only, controlled (resolved, onResolve, resolvedBy) or not (defaultResolved; the resolver is currentUser). disabled reads only. Its words are the comments… and comment… keys of commentsThreadLabels in SatinLabels (Send, Cancel and Sending are Free's send, cancel and sending). Parts: Comment (state="sending" | "failed", actions, footer), CommentComposer and CommentActions`.
| Prop | Type | Default |
|---|---|---|
comments | CommentItem[] | — |
currentUser | CommentAuthor | — |
CommentAuthor.kind | "person""agent" | "person" |
CommentMention.avatar | ReactNode | — |
CommentMention.kind | "person""agent" | — |
onReply | (parentId: string | null, body: string, mentions: CommentMention[]) => void | Promise<void> | — |
onEdit | (id: string, body: string, mentions: CommentMention[]) => void | Promise<void> | — |
onDelete | (id: string) => void | Promise<void> | — |
resolvable | boolean | false |
resolved | boolean | — |
defaultResolved | boolean | false |
onResolve | (resolved: boolean) => void | Promise<void> | — |
resolvedBy | CommentAuthor | — |
moderator | boolean | false |
mentions | { search: (query: string) => CommentAuthor[] | Promise<CommentAuthor[]> } | — |
disabled | boolean | false |
empty | ReactNode | "No comments yet" |
Comment.state | "sending""failed" | — |
Comment.actions / footer | ReactNode | — |
Comment.animateIn | boolean | false |
CommentComposer.onSubmit | (body: string, mentions: CommentMention[]) => void | — |
CommentComposer.value / defaultValue | PromptValue | — |
CommentComposer.onCancel | () => void | — |
CommentComposer.start | ReactNode | — |
CommentActions.authorName | string | — |
CommentActions.onEdit / onDelete | () => void | — |
className | string | — |
ref | Ref<HTMLDivElement> | — |
...props | ComponentProps<'div'>Other attributes go to <div> | — |
Accessibility
The threads are a list named "Comments" (comments in SatinLabels), replies a nested list under their root. Each comment is an <article> with tabIndex={-1}, named by its author and full date, "Comment by Marta Nowak, Monday, November 16, 2026 at 9:40 AM"; the visible time is Free's RelativeTime, whose short text is hidden from screen readers. Avatars are hidden; the name says who. An agent's "Agent" badge is text, read after its name. A mention is a tab stop; its tooltip, opened on focus or hover, describes it with the full name (the avatar in it hidden). Edit is a button next to Reply on your own comments, and "(me)" after your name is read with it. The ⋯ button is named "Actions for comment by Marta Nowak" and opens a menu with Delete. With title the thread is a region named by its heading, and the count in the Badge is read as "5 comments". The composer's field is named "Comment" (a reply's "Reply to Jon Park"); Send stays aria-disabled while it is blank. Under it the formatting toolbar is Free's Toolbar (role="toolbar", "Formatting"), one tab stop; its icon buttons are named Bold, Italic, Code, Bulleted list and Link, with aria-keyshortcuts and a tooltip with the keys, and a press keeps focus and the selection in the field. Formatting is markdown in the text, so a screen reader reads the marks as written. Its @ menu is the Prompt bar's: focus stays in the field, which has aria-autocomplete="list", aria-controls and aria-activedescendant while rows show, and a status region counts the suggestions. A comment being sent is aria-busy, with a Spinner named "Sending". After a failed send focus moves to Retry, described by "Not sent"; after Discard it goes back to the composer. After Delete focus moves to the next comment, or the composer; the toast with Undo is read out like any toast, and Undo puts focus on the restored comment. A failed edit reopens the field with its error, aria-invalid. After Resolve focus goes to Reopen on the resolved bar; Show comments has aria-expanded and aria-controls; after Reopen focus goes back to Resolve. New comments fade in 4px; reduced motion turns it off. New comments are not announced; when others' comments arrive live, say so from your own status region.
| Key | Action |
|---|---|
| Tab | Moves through mentions, Reply and Edit, the ⋯ buttons, Retry and Discard, the composer, its formatting toolbar, Resolve and Send. |
| Ctrl+Enteror⌘Enter | In a composer or the edit field: sends, or saves the edit. |
| ⌘Bor⌘Ior⌘Eor⌘K | In a composer: wraps the selection in bold, italic or code marks, or as a link with its address selected (Ctrl off Apple). |
| ←or→ | In the formatting toolbar: moves between its buttons. |
| Enter | In a composer: a new line. With the @ menu open: inserts the highlighted person. |
| @ | At the start or after a space: opens the mentions menu; the text typed after it filters it. |
| ↑or↓ | In the @ menu: moves the highlight, wrapping at the ends. |
| Tab | In the @ menu: inserts the highlighted person. |
| Backspace | Right after a mention: removes all of it. |
| Esc | Closes the @ menu first; then closes a reply composer (focus back on Reply) or cancels an edit. |
| EnterorSpace | On the ⋯ button: opens the menu with Delete; Enter picks it. |
| F8 | Moves to the toast after a delete, to reach Undo (the Toaster's hotkey). |
Something wrong or missing on this page?
Report a problemSuggest an improvement