Comment
A single message in a discussion, with author, time, and text.
- Status
- ReadyBuild day 5 of 21
- Code
- In React
- Role
- Display
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Comment, type CommentState } from "@/ui";
export default function CommentDemo() {
const [resolved, setResolved] = useState<boolean>(false);
const state: CommentState = resolved ? "resolved" : "default";
return (
<Comment
author="Siti Nur Aisyah"
role="Approver"
timestamp="2 hours ago"
state={state}
onReply={() => {}}
onToggleResolved={() => setResolved(!resolved)}
>
Payslip documents check out. Moving on to collateral verification.
</Comment>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- author
- string · default none
- Required. The name. It also makes the avatar initials.
- role
- string · default none
- A tag next to the name, such as Approver.
- timestamp
- string · default none
- Required. Pass the formatted time.
- type
- "thread" | "annotation" · default "thread"
- Thread has actions. Annotation has a 3px warning accent and no actions.
- state
- "default" | "highlight" | "resolved" · default "default"
- Highlight is brand colored. Resolved is muted.
- onReply
- () => void · default none
- Shows Reply. Thread only.
- onToggleResolved
- () => void · default none
- Shows Resolve, or Reopen when the state is resolved. Thread only.
- children
- ReactNode · default none
- The comment text.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- type
- thread or annotation.
- 🎯 State
- state
- default, highlight, or resolved.
- Title, Label, Timestamp
- author, role, timestamp
- Name, tag, and time.
- Description
- children
- The text.
- Show Actions, Button Value
- onReply, onToggleResolved
- Pass the handlers to show the actions.
- Show Image
- None
- No prop. The avatar always shows initials.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Reply and Resolve are native buttons: Tab focuses them and Enter or Space activates them.
Screen readers
- An article labeled Comment by the author.
- The avatar is named by the author, so the name is read twice. Pass the avatar name only when it adds something.
What you still need to do
- Do not rely on the highlight or the accent color alone to say a comment is new or resolved. Say it in text.
- The more-options menu in the design is not in code yet.
When to use
Review notes, support threads, and activity on a record.
Do and don't
Do
- Show when the comment was posted.
- Use initials when there is no profile photo.
Don't
- Truncate a comment without a way to read the rest.
- Show edit actions to people who cannot edit.
Related
4 of 16 other atoms, same role and ready ones first.
- AvatarA visual representation of a user, team, or entity.Ready
- BadgeA small label used to highlight status, category, or count.Ready
- ChipA compact label for a category, filter, or selected value.Ready
- HeadlineA page or section title set in the Urbanist header scale.Ready
Status reflects the component tracker snapshot of 29 October 2026.