ValyroUI Русская версия

Post Card

Social post card. Pro · Content and social › Social

Installation

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';

Props

PropTypeDefault
author *PostAuthorByline: avatar, name, verified badge and @handle.
time *DateInputPosting time (Date, ISO string or epoch ms), shown as a live relative age like "5m".
text *stringPlain-text body, clamped to maxLines with a "Show more" button.
mediaMediaItem[]Attached images, laid out as a MediaGallery mosaic with a fullscreen viewer.
linkPostLinkPreviewLink preview card under the text; opens in a new tab when it has href.
commentCountnumber0Shown next to the comment button in compact form; hidden at 0.
repostCountnumber0Server count; it already includes the viewer's repost when reposted started true.
likeCountnumber0Server count; it already includes the viewer's like when liked started true.
likedbooleanControlled liked; use with onLikedChange.
defaultLikedbooleanfalseInitial liked when uncontrolled.
onLikedChange(liked: boolean) => voidCalled with the new liked when it changes.
repostedbooleanControlled reposted; use with onRepostedChange.
defaultRepostedbooleanfalseInitial reposted when uncontrolled.
onRepostedChange(reposted: boolean) => voidCalled with the new reposted when it changes.
bookmarkedbooleanControlled bookmarked; use with onBookmarkedChange.
defaultBookmarkedbooleanfalseInitial bookmarked when uncontrolled.
onBookmarkedChange(bookmarked: boolean) => voidCalled with the new bookmarked when it changes.
onComment() => voidCalled by the comment button.
onShare() => voidCalled by the share button.
menuItemsPostMenuItem[][]Entries of the "more" menu; the button is hidden when empty.
maxLinesnumber4Lines of text shown before "Show more" (default 4).
localestringLocale for counts and dates (default: the ThemeProvider's, then the browser's).
labelsPartial<PostCardLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Interactive Quote Deck · Next: Comment Thread · All Content and social