Post Card
Карточка публикации. Pro · Контент и соцсети › Соцсети
Установка
npx valyro-cli@latest login
npx valyro-cli@latest add post-card
npm install valyro-ui-pro
import 'valyro-ui-pro/styles.css';
import { PostCard } from 'valyro-ui-pro';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
author * | PostAuthor | Byline: avatar, name, verified badge and @handle. | |
time * | DateInput | Posting time (Date, ISO string or epoch ms), shown as a live relative age like "5m". | |
text * | string | Plain-text body, clamped to maxLines with a "Show more" button. | |
media | MediaItem[] | Attached images, laid out as a MediaGallery mosaic with a fullscreen viewer. | |
link | PostLinkPreview | Link preview card under the text; opens in a new tab when it has href. | |
commentCount | number | 0 | Shown next to the comment button in compact form; hidden at 0. |
repostCount | number | 0 | Server count; it already includes the viewer's repost when reposted started true. |
likeCount | number | 0 | Server count; it already includes the viewer's like when liked started true. |
liked | boolean | Controlled liked; use with onLikedChange. | |
defaultLiked | boolean | false | Initial liked when uncontrolled. |
onLikedChange | (liked: boolean) => void | Called with the new liked when it changes. | |
reposted | boolean | Controlled reposted; use with onRepostedChange. | |
defaultReposted | boolean | false | Initial reposted when uncontrolled. |
onRepostedChange | (reposted: boolean) => void | Called with the new reposted when it changes. | |
bookmarked | boolean | Controlled bookmarked; use with onBookmarkedChange. | |
defaultBookmarked | boolean | false | Initial bookmarked when uncontrolled. |
onBookmarkedChange | (bookmarked: boolean) => void | Called with the new bookmarked when it changes. | |
onComment | () => void | Called by the comment button. | |
onShare | () => void | Called by the share button. | |
menuItems | PostMenuItem[] | [] | Entries of the "more" menu; the button is hidden when empty. |
maxLines | number | 4 | Lines of text shown before "Show more" (default 4). |
locale | string | Locale for counts and dates (default: the ThemeProvider's, then the browser's). | |
labels | Partial<PostCardLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Comment Thread — Дерево комментариев
- Profile Card — Профиль пользователя
- Reaction Bar — Лайки и реакции
- Article Header — Шапка статьи: рубрика, заголовок, лид, авторы и дата
- Byline — Подпись: авторы, дата публикации и обновления, время чтения
- Article Figure — Иллюстрация с подписью и автором фото
- Pull Quote — Выносная цитата с атрибуцией
- Key Points — Блок «Главное» с ключевыми тезисами
- Editor Note — Обновление, исправление, раскрытие и пометка о спонсорстве
- Article Toc — Оглавление статьи с подсветкой текущего раздела
- Reading Progress — Полоса прогресса чтения
- Share Bar — Поделиться: Telegram, VK, X, WhatsApp, почта и копирование ссылки
Назад: Interactive Quote Deck · Далее: Comment Thread · Весь раздел «Контент и соцсети»