Skip to main content
Version: latest
Works everywhere

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

Card

Card is a multipurpose container that groups related content. It supports multiple visual colors (panel, list-item), optional shadow, animated entrance, and a clickable mode via redirect or onClick.

Live demo →

Overview

import { Card } from "@prokodo/ui/card"
;<Card color="panel" enableShadow animated={false}>
<h2>Title</h2>
<p>Card content goes here.</p>
</Card>

Import

import { Card } from "@prokodo/ui/card"

CSS:

import "@prokodo/ui/card.css"

Props

PropTypeDefaultRequiredDescription
childrenReactNodeCard content.
colorVariantsAccent color (border / shadow tint).
highlightbooleanfalseApply highlight visual treatment.
gradiantbooleanfalseApply gradient overlay.
gradiantClassNamestringCSS class on gradient overlay element.
contentClassNamestringCSS class on inner content wrapper.
backgroundbooleanfalseRender background element.
backgroundPropsobjectProps forwarded to the background element.
loadingbooleanfalseShow skeleton loading state.
skeletonPropsSkeletonPropsProps for the skeleton placeholder.
disabledbooleanfalseApply disabled visual state.
animatedPropsAnimatedPropsEntrance animation config.
customAnimationstringCustom animation class override.
onClick() => voidCard click handler.
onKeyDownReact.KeyboardEventHandlerKeyboard event handler.
onMouseEnter() => voidMouse enter handler.
onMouseLeave() => voidMouse leave handler.
classNamestringCSS class on root element.

See src/components/card/Card.model.ts for the full CardProps type.


Design Tokens

Customise Card via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-card-bgvar(--pk-color-surface)Card background colour
--pk-card-panel-light-borderrgba(0, 0, 0, 0.08)Light panel border (for light-mode panels on light backgrounds)

AIC Note

Use the standard import path in application code:

import { Card } from "@prokodo/ui/card"

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.
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
2.5.8Target Size (Minimum) (AA)🔍 Manual reviewInteractive target areas must be at least 24 × 24 CSS pixels. Verify in the integrated product UI.
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) · 1 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Card in Storybook


Source

src/components/card/Card.model.ts