🚧 Rspress 2.0 document is under development
close

PrevNextPage eject-only

Warning

This is an eject-only component, designed specifically for wrap/eject, and is not recommended for direct use in MDX files

PrevNextPage renders previous/next navigation links at the bottom of the page.

Usage

index.mdx
import { PrevNextPage } from '@rspress/core/theme';

<PrevNextPage />;

This component does not accept any props. It automatically calculates the previous/next page links based on the sidebar order.

How it works

The component internally uses the usePrevNextPage hook to get the previous and next page information:

import { usePrevNextPage } from '@theme';

const { prevPage, nextPage } = usePrevNextPage();
// prevPage: { text: string; link: string } | null
// nextPage: { text: string; link: string } | null
  • Previous/next pages are automatically calculated based on the current page's position in the sidebar
  • If the current page is the first page, prevPage will be null
  • If the current page is the last page, nextPage will be null