Skip to content

← All components

Brand and content

LatestPostCard

Compact highlighted latest-publication link.

Live example

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { LatestPostCard } from "@cofob/design-system-react";

/**
 * Complete LatestPostCard parameter reference.
 * @param post
 *   type: PostModel
 *   required
 *   example: {post}
 * @param headingLevel
 *   type: 2 | 3 | 4
 *   default: 2
 *   example: 2
 * @param eyebrow
 *   type: string | ReactNode
 *   default: "Latest post"
 *   example: "Latest post"
 * @param anchor attributes
 *   type: native element attributes
 *   default: —
 *   example: class / style / aria-* / data-*
 */
export function LatestPostCardExample() {
  return (
    <LatestPostCard post={post} />
  );
}

Svelte

svelte
<script lang="ts">
  import { LatestPostCard } from "@cofob/design-system-svelte";

  // Complete LatestPostCard parameter reference.
  // post
  //   type: PostModel
  //   required
  //   example: {post}
  // headingLevel
  //   type: 2 | 3 | 4
  //   default: 2
  //   example: 2
  // eyebrow
  //   type: string | ReactNode
  //   default: "Latest post"
  //   example: "Latest post"
  // anchor attributes
  //   type: native element attributes
  //   default: —
  //   example: class / style / aria-* / data-*
</script>

<LatestPostCard post={post} />

HTML

html
<!--
  Complete LatestPostCard parameter reference.
  post
    type: PostModel
    required
    example: {post}
  headingLevel
    type: 2 | 3 | 4
    default: 2
    example: 2
  eyebrow
    type: string | ReactNode
    default: "Latest post"
    example: "Latest post"
  anchor attributes
    type: native element attributes
    default: —
    example: class / style / aria-* / data-*
-->
<a class="cf-latest-post-card" href="/post">…</a>

<script type="module">
  import { initDesignSystem } from "@cofob/design-system-css";

  const designSystem = initDesignSystem(document);
  window.addEventListener("pagehide", () => designSystem.destroy(), { once: true });
</script>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
postrequiredPostModelrequiredReact · Svelte · HTML{post}Portable post metadata including URL, title, dates, tags, and cover image.
headingLevel2 | 3 | 42React · Svelte · HTML2Semantic heading level inside a post card.
eyebrowstring | ReactNode"Latest post"React · Svelte · HTML"Latest post"Short label above the latest-post title.
anchor attributesnative element attributesReact · Svelte · HTMLclass / style / aria-* / data-*Forwards native class/style, accessibility, event, and data attributes to the root element.