users
Description
Optional. Provides a list of users that can be associated with commentsUsage
users?: {
id: string | number;
name?: string;
avatar?: string;
color?: string;
}[];
Parameters
id
- (required) unique identifier of the username
- (optional) displays the name of a useravatar
- (optional) URL of the user's avatar imagecolor
- (optional) the color used for styling the user's comments
Example
Initializing comments widget with data and list of users:
import { useState } from "react";
import { Comments } from "@svar-ui/react-comments";
export default function App() {
const [value, setValue] = useState([
{
id: "1",
content: "Hello, world!",
user: 1,
date: new Date(),
},
]);
const users: {
id: number | string;
name?: string;
avatar?: string;
color?: string;
}[] = [
{ id: 1, name: "John Doe" },
{ id: 2, name: "Jane Doe" },
];
return <Comments value={value} users={users} />;
}