ValyroUI English version

Article Comments

Комментарии к статье: рейтинг, сортировка, ответы, модерация. Pro · Контент и соцсети › Лента и новости

Установка

npx valyro-cli@latest login
npx valyro-cli@latest add article-comments
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { ArticleComments } from 'valyro-ui-pro';

Пропсы

PropTypeDefault
valueArticleComment[]Controlled value; use with onValueChange.
defaultValueArticleComment[][]Initial value when uncontrolled.
onValueChange(comments: ArticleComment[]) => voidCalled with the new value when it changes.
sort'top' | 'newest' | 'oldest'Order of top-level comments; replies stay chronological.
defaultSort'top' | 'newest' | 'oldest''top'Initial sort when uncontrolled.
onSortChange(sort: ArticleCommentsSort) => voidCalled with the new sort when it changes.
currentUserArticleCommentAuthorThe signed-in reader. Without one, the composer gives way to a sign-in prompt.
onSignIn() => voidShows a "Sign in" button in the prompt for signed-out readers.
onPost(comment: ArticleComment, parentId: string | null) => voidCalled after a comment is posted; parentId is null for top-level comments.
onVote(commentId: string, vote: -1 | 0 | 1) => voidCalled after the reader votes; the list already updated the score.
onReport(commentId: string) => voidShows a "Report" action on other readers' comments.
totalCountnumberNumber in the header when the list holds only a page of the discussion (default: the comments in the list).
hasMorebooleanfalseMore comments can be loaded: shows a "Show more comments" button.
onLoadMore() => voidCalled by the "Show more comments" button.
loadingMorebooleanfalseThe next page is loading: the button shows a spinner.
closedbooleanfalseDiscussion closed: no composer and no reply buttons.
maxLengthnumber2000Longest comment in characters (default 2000); a counter appears near the limit.
rulesReactNodeCommunity rules or a moderation note under the composer.
maxDepthnumber3Nesting levels that get their own indentation; deeper replies line up with their parent (default 3).
headingLevel1 | 2 | 3 | 4 | 5 | 62Level of the title (default 2).
localestringBCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's.
labelsPartial<ArticleCommentsLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • Article Card — Карточка новости: вертикальная, горизонтальная и поверх фото
  • Live Blog — Онлайн-трансляция: лента обновлений, закреплённые и важные события
  • Breaking News — Плашка «Срочно» с ротацией заголовков
  • Article Header — Шапка статьи: рубрика, заголовок, лид, авторы и дата
  • Byline — Подпись: авторы, дата публикации и обновления, время чтения
  • Article Figure — Иллюстрация с подписью и автором фото
  • Pull Quote — Выносная цитата с атрибуцией
  • Key Points — Блок «Главное» с ключевыми тезисами
  • Editor Note — Обновление, исправление, раскрытие и пометка о спонсорстве
  • Article Toc — Оглавление статьи с подсветкой текущего раздела
  • Reading Progress — Полоса прогресса чтения
  • Share Bar — Поделиться: Telegram, VK, X, WhatsApp, почта и копирование ссылки

Назад: Breaking News · Далее: Citation Evidence Lens · Весь раздел «Контент и соцсети»