Article Card
Two article tiles that share one focusable-anchor shell: `ArticleCard`, the stacked grid tile with the cover on top, and `FeaturedArticleCard`, the full-bleed hero whose copy sits on a gradient scrim over the image. Both read the same props.
Preview
Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.
Install
Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.
npx shadcn@latest add https://ds.interlace.tools/r/article-card.jsonnpx shadcn@latest add @interlace/article-cardBehavior
What this component does — the keyboard path, the measured colour, the text equivalent and the states it can be in. Every figure below is read out of the test or the source that enforces it by scripts/build-behavior-map.mjs, so nothing here can outlive the gate that keeps it true.
Measured contrast
packages/ui/__tests__/theme-contract-lock.test.ts ↗Every semantic colour pair this component's own source uses, measured against the shipped hexes in all 4 theme × scheme combinations. The tightest is muted-foreground on background at 7.82:1 (harbor · light), against a floor of 4.5:1.
| Pair | interlacelight | interlacedark | harborlight | harbordark | Floor |
|---|---|---|---|---|---|
| muted-foreground on backgroundsecondary copy | 9.41:1 | 11.32:1 | 7.82:1 | 9.52:1 | 4.5:1SC 1.4.3 |
| muted-foreground on cardsecondary copy in a card | 9.41:1 | 10.48:1 | 8.25:1 | 8.64:1 | 4.5:1SC 1.4.3 |
| ring on backgroundfocus ring (SC 2.4.13) | 8.80:1 | 11.79:1 | 8.39:1 | 10.03:1 | 3.0:1SC 1.4.11 |
| primary on backgroundprimary tint on the page surface | 8.80:1 | 11.79:1 | 8.39:1 | 10.03:1 | 3.0:1SC 1.4.11 |
| ring on cardfocus ring inside a card | 8.80:1 | 10.92:1 | 8.86:1 | 9.10:1 | 3.0:1SC 1.4.11 |
| primary on cardprimary tint inside a card | 8.80:1 | 10.92:1 | 8.86:1 | 9.10:1 | 3.0:1SC 1.4.11 |
| foreground on backgroundbody copy | 19.65:1 | 16.97:1 | 17.74:1 | 16.19:1 | 4.5:1SC 1.4.3 |
| scrim-foreground on scrimcopy over an image scrim | 21.00:1 | 21.00:1 | 21.00:1 | 21.00:1 | 4.5:1SC 1.4.3 |
Text pairs are held to 4.5:1 (WCAG 2.2 SC 1.4.3); borders, rings and chart axes to 3:1 (SC 1.4.11 non-text). Bold is the worst cell in the row — the one a brand fork has to keep an eye on.
Runtime contract
packages/ui/vitest.config.ts ↗Where it renders, how narrow it survives, and whether its lines are inside the coverage gate — three answers a consumer needs before the paste, not after the bug.
- Render boundary
'use client'Hydrates. It brings JavaScript to any route that imports it — put the boundary here, not at the page.
- Minimum viewport
none declaredNo width floor: it takes the width it is given. Its container owns the layout question.
- Coverage gate
not in the gateThe 100% gate currently covers
src/charts/**/*.{ts,tsx}andsrc/lib/**/*.{ts,tsx}andsrc/primitives/{button-variants,data-state-model,meter-scale,skeleton-variants}.tsandsrc/primitives/{alert,aspect-ratio,avatar,badge,box,breadcrumb,button,callout,card,checkbox,container,data-state,focus-ring,grade-badge,grid,input,label,meter,pagination,published-date,reading-time,section,section-boundary,separator,skip-link,stack,stat-strip,tag,textarea,typography,visually-hidden}.tsx. This file is outside it — the glob widens in phase 7.2.
History
This component is at v1.5.0, first shipped in @interlace/ui 1.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.
@interlace/ui 1.1.02 entries
- Changedpatch
Six defects found by upgrading a real consumer, plus five found by reading the components closely enough to document them. **
Meteors' glow never painted.** It readvar(--color-meteor-glow)while itscssVarsdeclare--meteor-glow;--color-*is the Tailwind@themenamespace and onlycssVars.themepopulates it, so the wholebox-shadowwas invalid at computed-value time. **This was broken only for registry consumers** — our own docs site hand-declares the--color-form. **ArticleCardcropped 28% off every cover.**h-44is 176px; at a ~302px tile that is a 1.72:1 box against a 2.381:1 image. Nowaspect-[1000/420]— the ratio the card already declared on its<img>. It also gains arenderImageslot, because every Next.js consumer was re-patching the same line to usenext/imageand the design system cannot depend on it. **BorderBeamandStarsBackgroundhad noaria-hiddenat all** — six purely decorative nodes a screen reader walked. **CloudParticlesdefaultedbodyColortocurrentColor**, painting volumetric clouds in the inherited text colour. **NumberTickergainsnotation**, because six-figure metrics overflow a tile at 320px. Also:SheetComposeandDialogComposeeach mounted a second backdrop, so a composed dialog dimmed the page twice as much as the hand-composed tree the docs show;AccordiondroppedclassNameon the animated Panel;Tooltipaccepteddelayand discarded it;PopoverAnchorwas a second trigger. **useReducedMotionwas one frame late.** The canonicaluseState(false)plus effect returnsfalseon the first render, so every gated component painted one frame of exactly the motion the user turned off.useSyncExternalStorereads during render and closes that on client renders; on hydration the server cannot know the preference, which is what the stylesheet reset is for.Badgedrops'use client'— verified with a real server-component build. - Changedpatch
The fourteen
blocks/*re-export aliases now name the release they disappear in. They previously said "removal scheduled for one release cycle after the architecture PR lands", which is not a date anyone can plan around — so the aliases were, in practice, permanent. They are now@deprecated since 1.0.0 — removed in 2.0.0, and removal will land as a breaking change with a migration note.
Import
4 named exports — pull the parts you need.
import { ArticleCard, ArticleCardVariant, FeaturedArticleCard, FeaturedArticleCardProps } from '@/components/ui/patterns/article-card';Anatomy
Extracted from the primitive's JSDoc header. The source is the only documentation that can't drift.
CardShell (a[href] — data-slot="article-card")
└─ Card (primitives/card, py-0 gap-0)
├─ StackBody (ArticleCard)
│ ├─ cover aspect-[1000/420] + SourceChip
│ ├─ CardHeader (avatar + author name + date)
│ ├─ CardContent (title, description, tag Badges)
│ └─ CardFooter (MetaChips + ExternalLink on hover)
└─ OverlayBody (FeaturedArticleCard)
├─ absolute cover + scrim gradient
├─ FeaturedChip / SourceChip
└─ tags, h2 title, description, author · date · MetaChipsAPI reference
Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.
ArticleCardImageProps
| Prop | Type | Description |
|---|---|---|
| src* | string | — |
| alt* | string | Always `''`. The cover is decorative; the card title is the accessible name. |
| width* | number | Intrinsic cover dimensions — also the ratio the cover box reserves. |
| height* | number | — |
| loading* | 'eager' | 'lazy' | — |
| fetchPriority* | 'high' | 'auto' | — |
| decoding* | 'async' | — |
| className* | string | Carries `object-cover`, the object-position, and the `motion-safe:group-hover:scale-105` hover gate. Forward it to keep the card's motion and reduced-motion contract; drop it and you own both. |
ArticleCardBaseProps
| Prop | Type | Description |
|---|---|---|
| title | string | Card title (article headline). Optional when `loading={true}`. |
| description | string | Optional short description / excerpt. |
| href | string | Destination URL. The whole card becomes a link to it. Optional when `loading={true}`. |
| imageUrl | string | Cover image URL. If omitted, a gradient with the title is shown. |
| tags | string[] | Tags / topics — first 3 rendered as filled badges, the rest as a "+N" overflow chip. |
| author | ArticleCardAuthor | Author block. |
| publishedAt | string | number | Date | Publication date (any value `Date` constructor accepts). Rendered short-form: `Mar 5, 2026`. |
| meta | ArticleCardMeta | Reactions / comments / reading-time chips on the footer. |
| sourceLabel | string | Small uppercase label shown over the cover (e.g., source attribution like "Dev.to"). |
| external | boolean | Open in a new tab. @default true |
| priority | boolean | Hint the cover image is the LCP element on this route. Eager-loads it with `fetchpriority="high"`. Set on the single featured card above the fold; leave default on every grid tile. @default false |
| renderImage | (props: ArticleCardImageProps) => React.ReactNode | Render the cover with something other than a plain `<img>` — typically `next/image`, which the DS cannot depend on and stay framework-agnostic. Receives the full {@link ArticleCardImageProps} bag the card would otherwise have spread onto the element. Defaults to exactly that spread, so omitting it is identical to the behaviour before the slot existed. A `next/image` adapter is a one-line function that forwards the bag; keep `className`, which carries the fit and the reduced-motion gate. The live example is Storybook's `Blocks/ArticleCard → renderImage` story. It is deliberately NOT a fenced code block in this comment: the registry build inlines these headers into `r/*.json`, and a JSDoc usage example has already made 131 of 132 items silently uninstallable once. Not called at all when `imageUrl` is absent — the gradient-and-title fallback is the card's own chrome, not an image. |
| className | string | Class on the outer anchor wrapper. |
| loading | boolean | When true, render a `<Skeleton variant="article-card" />` composite (image + title lines + meta row silhouette) instead of the card. Shape-matched so card grids don't shift on data arrival. @default false |
ArticleCardProps
| Prop | Type | Description |
|---|---|---|
| variant | ArticleCardVariant | @deprecated Pass no `variant` for the stacked tile; render `<FeaturedArticleCard>` instead of `variant="overlay"`. A kind-prop that switches the whole rendered tree hides two components inside one type (R11). Still honoured for one minor, with a dev-mode warning. |
BodyProps
| Prop | Type | Description |
|---|---|---|
| title* | string | — |
| visibleTags* | string[] | — |
| overflowTags* | number | — |
| testId* | string | Root test id — every part derives its own id from this. |
Skeleton
Pass loading and the component renders a shape-matched <Skeleton /> in its own place — same box, so nothing reflows when the data lands. Below is the same story with loading={true}.
<ArticleCard loading={isPending} />Accessibility
Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.
What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.
- Focus + keyboard behaviour
- Native element semantics — no interaction layer to get wrong.
- Focus ring (WCAG 2.2 SC 2.4.13)
- Inherited from the preflight focus contract shipped in @interlace/theme.
- Reduced motion
- Animation is gated on prefers-reduced-motion.
- ARIA in the source
- None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.
Examples
16 more states from the same story file.
R-rule compliance
Every primitive in @interlace/ui models to the portable 26-rule floor enforced by the componentApi ESLint preset. The cells below pin exactly where each rule applies in this file.
| Rule | Concept | Where |
|---|---|---|
| R5 | testid required, no default | `'data-testid': string` → `{value}-title` / `-tags` / … |
| R6 | data-slot on every part | `article-card` / `-source` / `-scrim` / `-meta-views` |
| R10 | Composition seam | `CardShell` wraps both bodies; `Card*` primitives inside |
| R11 | No kind-prop | two exports, `variant` deprecated |
| R19 | Tokens only | `bg-scrim/70`, `text-scrim-foreground`, `text-primary` |
| R23 | CLS=0 | stack cover reserves `aspect-[1000/420]`; hero pins `h-105 md:h-95` |
| R25 | Client component | `React.useEffect` in the deprecation warning |
| R26 | A11y | cover `alt=""`; overlay title is `<h2>` for heading order |
| R5 | testid required, no default | `'data-testid': string` → `{value}-title` etc. |
| R6 | data-slot on every part | `article-card` / `-title` / `-tags` / `-meta` |
| R11 | No kind-prop | `variant` deprecated; layouts are separate components |
| R19 | Tokens only | scrim + semantic status tokens, no palette escapes |
| R23 | CLS=0 | cover reserves `h-44`; `loading` paints a shape-match |
| R25 | Deprecation | `variant` warns in dev before it is removed |
Dependencies
- Base UI primitive
- Native / no Base UI dependency
- Lucide icons
ClockExternalLinkEyeHeartMessageCircleSparkles
- NPM dependencies
lucide-react
- Registry dependencies
Source
The full implementation — components/ui/patterns/article-card.tsx once installed.
'use client';
import * as React from 'react';
// @interlace/article-card v1.5.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/article-card
// What changed since: https://ds.interlace.tools/c/article-card#history
// Generated banner — keep it, the upgrade diff reads this version.
/**
* @interlace/ui — ArticleCard + FeaturedArticleCard
*
* Two article tiles that share one focusable-anchor shell: `ArticleCard`, the
* stacked grid tile with the cover on top, and `FeaturedArticleCard`, the
* full-bleed hero whose copy sits on a gradient scrim over the image. Both
* read the same props.
*
* They are two components rather than one `variant` prop because the rendered
* tree differs entirely (R11). The old `variant` still type-checks for one
* minor: `variant="overlay"` delegates to `FeaturedArticleCard` and a
…929 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.