close

Root

Warning

This component is mainly used in conjunction with wrap/eject in Custom Theme , and is different from components that are directly imported in MDX. You can modify the styles and functions by passing component props or directly overriding the component. If you override the entire component through eject, please note that the reading of the corresponding configuration options of the component will become invalid and you need to control it yourself.

Root is the wrapper component for the entire application, wrapping all content (including Layout and global UI components).

Its source code is as follows:

export function Root({ children }: RootProps) {
  return <>{children}</>;
}

Usage

Use it through eject to wrap custom Providers:

theme/components/Root/index.tsx
import type { RootProps } from '@rspress/core/theme';

export function Root({ children }: RootProps) {
  return <YourProvider>{children}</YourProvider>;
}

Props

children

  • Type: ReactNode
  • Required: Yes

Child elements to render, containing the entire application content.