---
title: "Article Navigation"
description: "Links to the previous and next articles - rel=&quot;prev&quot; / rel=&quot;next&quot; cards with direction and title, or a minimal text row."
slug: "article-navigation"
---

import { DocPage, PageHeader, SkillPanel, SourceFiles, DocLink, SkillField, SkillText, SkillRow, ApiPill } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="article-navigation" title="Article Navigation" component="article-navigation">
  Links to the previous and next articles - rel="prev" / rel="next" cards with direction and title, or a minimal text row. Part of the <DocLink href="website-article.html">Article</DocLink> blocks.
</PageHeader>

<SkillPanel component="article-navigation">
  <SkillField label="Native basis">
<SkillText>A <code>&lt;nav&gt;</code> with two links - <code>rel="prev"</code> and <code>rel="next"</code> - each a direction label and the title. A lone next link keeps the end side; narrow, they stack.</SkillText>
  </SkillField>

  <SkillField label="Built from">
<SkillText><DocLink href="progress.html">Progress</DocLink>.</SkillText>
  </SkillField>

  <SkillField label="Web Platform APIs">
<SkillRow>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel" title="machine-readable sequence"><code>rel="prev" / "next"</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_containment/Container_queries" title="stack when narrow"><code>Container queries</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child" title="a lone next link keeps its side"><code>:only-child</code></ApiPill>
  </SkillRow>
  </SkillField>

  <SkillField label="Classes">
<SkillRow>
    <code>.mk-article-nav</code>
    <code>.mk-article-nav-link</code>
    <code>.mk-article-nav-dir</code>
    <code>.mk-article-nav-title</code>
  </SkillRow>
  </SkillField>

  <SkillField label="Data attributes">
<SkillText><code>data-variant="minimal"</code>; <code>rel="prev"</code> / <code>rel="next"</code> on the links; <code>data-variant</code> (<code>media</code>, <code>compact</code>).</SkillText>
  </SkillField>
</SkillPanel>

```html example label="Default" hint="Two cards: rel='prev' and rel='next' - the next link aligned to the end. Narrow the demo and they stack." previewStyle="align-items:stretch;"
<nav class="mk-article-nav" aria-label="More articles">
  <a class="mk-article-nav-link" href="#" rel="prev">
    <span class="mk-article-nav-dir"><i data-lucide="arrow-left" aria-hidden="true"></i> Previous</span>
    <span class="mk-article-nav-title">Designing for calm</span>
  </a>
  <a class="mk-article-nav-link" href="#" rel="next">
    <span class="mk-article-nav-dir">Next <i data-lucide="arrow-right" aria-hidden="true"></i></span>
    <span class="mk-article-nav-title">Testing sync with a lossy network</span>
  </a>
</nav>
```

```html example label="Only a next link" hint="The first article of a series: the lone next link keeps the end side." previewStyle="align-items:stretch;"
<nav class="mk-article-nav" aria-label="More articles">
  <a class="mk-article-nav-link" href="#" rel="next">
    <span class="mk-article-nav-dir">Next <i data-lucide="arrow-right" aria-hidden="true"></i></span>
    <span class="mk-article-nav-title">Part 2: the write-ahead log</span>
  </a>
</nav>
```

```html example label="Minimal" hint="data-variant='minimal': no cards - text under a rule." previewStyle="align-items:stretch;"
<nav class="mk-article-nav" data-variant="minimal" aria-label="More articles">
  <a class="mk-article-nav-link" href="#" rel="prev">
    <span class="mk-article-nav-dir"><i data-lucide="arrow-left" aria-hidden="true"></i> Previous</span>
    <span class="mk-article-nav-title">Designing for calm</span>
  </a>
  <a class="mk-article-nav-link" href="#" rel="next">
    <span class="mk-article-nav-dir">Next <i data-lucide="arrow-right" aria-hidden="true"></i></span>
    <span class="mk-article-nav-title">Testing sync with a lossy network</span>
  </a>
</nav>
```

```html example label="With thumbnails" hint="data-variant='media': a thumbnail on each card - on the outer side of each link." previewStyle="align-items:stretch;"
<nav class="mk-article-nav" data-variant="media" aria-label="More articles">
  <a class="mk-article-nav-link" href="#" rel="prev">
    <img src="images/mk-wide2.png" alt="" />
    <span class="mk-article-nav-dir"><i data-lucide="arrow-left" aria-hidden="true"></i> Previous</span>
    <span class="mk-article-nav-title">Designing for calm</span>
  </a>
  <a class="mk-article-nav-link" href="#" rel="next">
    <img src="images/mk-wide.png" alt="" />
    <span class="mk-article-nav-dir">Next <i data-lucide="arrow-right" aria-hidden="true"></i></span>
    <span class="mk-article-nav-title">Testing sync with a lossy network</span>
  </a>
</nav>
```

```html example label="Series" hint="Navigation inside a series: a Progress bar shows where the reader is, the compact variant keeps it to one line." previewStyle="align-items:stretch;"
<div style="display: grid; gap: 0.75rem; width: 100%">
  <div style="display: flex; align-items: center; gap: 0.75rem; font-size: 0.8125rem; color: var(--muted-foreground)"
    ><span>Sync, explained - part 2 of 4</span
    ><progress class="progress" value="2" max="4" aria-label="Part 2 of 4" style="flex: 1; max-width: 12rem"></progress
  ></div>
  <nav class="mk-article-nav" data-variant="compact" aria-label="Series">
    <a class="mk-article-nav-link" href="#" rel="prev">
      <span class="mk-article-nav-dir"><i data-lucide="arrow-left" aria-hidden="true"></i> <span>Previous</span></span>
      <span class="mk-article-nav-title">Part 1: Why CRDTs</span>
    </a>
    <a class="mk-article-nav-link" href="#" rel="next">
      <span class="mk-article-nav-dir"><span>Next</span> <i data-lucide="arrow-right" aria-hidden="true"></i></span>
      <span class="mk-article-nav-title">Part 3: Testing with a lossy network</span>
    </a>
  </nav>
</div>
```

<SourceFiles component="article-navigation" section="css" />

</DocPage>
