Skip to main content
Version: latest
Works everywhere

PostItem works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/post-item) — the library detects the runtime automatically.

PostItem

PostItem renders a compact, horizontal list-view item for a blog post or news article. Includes a thumbnail, optional category chip, title, excerpt, and publication date.

Live demo →

Overview

import { PostItem } from "@prokodo/ui/post-item"
;<PostItem
title="Getting started with prokodo UI"
slug="/blog/getting-started"
date="2024-03-01"
category="Tutorial"
image={{ src: "/blog/thumb.jpg", alt: "Thumbnail" }}
/>

Import

import { PostItem } from "@prokodo/ui/post-item"

CSS:

import "@prokodo/ui/post-item.css"

Props

PropTypeDefaultRequiredDescription
titlePostItemHeadlineHeadline config: { content: string } & HeadlineProps.
contentstringExcerpt / body text.
categorystringCategory label shown as a Chip.
imagestringImage URL for the thumbnail.
authorPostItemAuthorPropsAuthor info (avatar, name, etc.).
datestringISO date string (requires locale when provided).
localeIntl.LocalesArgumentLocale for date formatting (required when date is set).
metaDatestringPre-formatted date string (overrides date formatting).
wordCountnumberWord count used to calculate reading time.
readCountnumberRead count shown in meta.
buttonButtonPropsCTA button props.
animatebooleanfalseEnable entrance animation.
colorHeadlineVariantAccent color for card border/shadow and headline.
structuredDatabooleanfalseEmit JSON-LD structured data.
classNamestringCSS class on root element.

See src/components/post-item/PostItem.model.ts for the full PostItemProps type.


Color

The color prop applies a unified accent across all visual parts of the article card:

ValueCard border / shadowHeadline textButton color
"primary"Brand blue (30 % tint border + glow)Brand bluePrimary
"secondary"Accent cyan (30 % tint border + glow)Accent cyanSecondary
"success"Green indicatorGreenSuccess
"warning"Amber indicatorAmberWarning
"error"Red indicatorRedError
"info"Neutral fg tintMutedInfo
"white"Default white card, no shadowinherit (dark auto-contrast)inherit
"inherit"No overrideinheritinherit

Passing "white" keeps the card in its default surface while safely preventing invisible text or buttons in light mode.


Design Tokens

PostItem does not define component-specific CSS custom properties. Override appearance by customising the following global design-system tokens on :root or a scoped ancestor:

TokenDescription
--pk-space-xsMinimum horizontal padding
--pk-space-smSmall internal gap
--pk-space-mdMedium internal spacing
--pk-space-lgStandard layout gap (grid column gap)
--pk-space-xlWide layout gap on desktop (two-column layout)
--pk-color-mutedDate, read time, and excerpt text colour
--pk-radius-lgImage wrapper corner radius

Image responsiveness: The image background always renders with object-fit: cover and fills its container at all viewport sizes. On mobile the image column stretches to full width; on desktop it occupies the left 33 % column.


AIC Note

Use the standard import path in application code:

import { PostItem } from "@prokodo/ui/post-item"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.3.2Meaningful Sequence (A)🔍 Manual reviewContent reading order in the DOM must match the intended visual presentation order.
1.4.3Contrast (Minimum) (AA)🔍 Manual reviewText must have a contrast ratio of at least 4.5:1 (3:1 for large text). Verify against the final product theme.
2.4.6Headings and Labels (AA)🔍 Manual reviewHeadings and labels must describe the topic or purpose of their associated content.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 2 jest-axe assertion(s) across 5 test file(s) · 4 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open PostItem in Storybook


Source

src/components/post-item/PostItem.model.ts