Skip to contentWolf-Rayet

Comment

A comment shows discussion and feedback from users.

Install

One package and one stylesheet. The stylesheet holds the tokens every component uses.

pnpm add @wolf-rayet/react
import '@wolf-rayet/react/css/wolf-rayet.css';
import { Comment } from '@wolf-rayet/react';

Props

A required prop is marked with an asterisk.

PropTypeDefaultDescription
author *stringNoneWho wrote it. Their name as it appears elsewhere in the product.
time *stringNoneWhen it was written, formatted for people to read, not as a raw timestamp.
avatarReactNodeNoneTheir avatar. Optional, because the name already identifies them.
children *ReactNodeNoneThe comment itself.
actionsreadonly { label: string; onClick?: () => void }[]NoneActions on this comment, such as reply or edit. Keep them few.
nestedReactNodeNoneReplies to this comment. One level of nesting is usually enough.

Accessibility

What the component does for you, and what it needs from you.

  • The author and time are text, so screen readers read them with the comment.
  • Nesting is in the markup, so screen reader users know a reply is a reply without seeing the indentation.
  • Actions are buttons and must say which comment they belong to. Otherwise a thread full of Reply buttons is unclear.