Skip to main content

users

Description

Optional. Provides a list of users that can be associated with comments

Usage

users?: {
id: string | number;
name?: string;
avatar?: string;
color?: string;
}[];

Parameters

  • id - (required) unique identifier of the user
  • name - (optional) displays the name of a user
  • avatar - (optional) URL of the user's avatar image
  • color - (optional) the color used for styling the user's comments

Example

Initializing comments widget with data and list of users:

<script>
import { Comments } from '@svar-ui/svelte-comments';

const value = [
{
id: "1",
content: "Hello, world!",
user: 1,
date: new Date(),
},
];

const users = [
{ id: 1, name: "John Doe" },
{ id: 2, name: "Jane Doe" },
];
</script>

<Comments {value} {users} />