Blog / Content

Comment thread with replies

Discussion under an article, one level deep

Live preview
Build a comment section with Tailwind CSS. The header row shows a heading with the comment count and a small sort select for newest and oldest. Under it, a compose box: an avatar beside a bordered textarea with a placeholder, and a footer row with a muted markdown hint on the left and a dark Post button on the right that is disabled while the textarea is empty. Then four top-level comments, each with an avatar, a name with a small "Author" or "Moderator" pill where relevant, a relative timestamp, the comment body in relaxed prose, and an action row with an upvote count, a reply link and a report link. Two comments carry one indented reply each, marked by a left hairline. Close with a muted line about the code of conduct. Then add JavaScript that enables the Post button once text is entered, toggles upvote counts, and opens a small inline reply box under the comment when Reply is clicked.