Skip to main content
Version: latest
Works everywhere

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

PostWidget

PostWidget renders a compact sidebar panel listing recent or related posts. Each entry shows a thumbnail, title, and date.

Live demo →

Overview

import { PostWidget } from "@prokodo/ui/post-widget"
;<PostWidget title="Recent posts" posts={latestPosts} />

Import

import { PostWidget } from "@prokodo/ui/post-widget"

CSS:

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

Props

PropTypeDefaultRequiredDescription
itemsPostWidgetItem[]Array of post items.
titlePostWidgetHeadlineWidget heading: { content: string } & HeadlineProps.
fullWidthbooleanfalseStretch card to full container width.
colorVariantsAccent color (extends CardProps).
structuredDatabooleanfalseEmit JSON-LD structured data.
classNamestringCSS class on root element.

See src/components/post-widget/PostWidget.model.ts for the full PostWidgetProps type.


Color

The color prop colors the entire widget with a shared accent from the design-system palette:

ValueCard border / shadowWidget titleItem headlines
"primary"Brand blue (30 % tint border + glow)Brand blueBrand blue
"secondary"Accent cyan (30 % tint border + glow)Accent cyanAccent cyan
"success"Green indicatorGreenGreen
"warning"Amber indicatorAmberAmber
"error"Red indicatorRedRed
"info"Neutral fg tintMutedMuted
"white"Default white card, no shadowinherit (dark auto-contrast)inherit

When no color is passed, both the widget title and item headlines fall back to "inherit" (default text color), keeping a neutral appearance.


Design Tokens

PostWidget 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-lgList item top spacing and column gap
--pk-space-mdThumbnail right margin
--pk-color-mutedDate text colour
--pk-radius-mdThumbnail image corner radius

AIC Note

Use the standard import path in application code:

import { PostWidget } from "@prokodo/ui/post-widget"

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 4 test file(s) · 3 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open PostWidget in Storybook


Source

src/components/post-widget/PostWidget.model.ts