@@ -24,6 +24,7 @@ Guide for customizing Rspress (v2) themes. Rspress offers four levels of customi
2424| Add content around existing components (banners, footers, logos) | 3 | Layout slots (wrap) |
2525| Override MDX rendering (custom ` <h1> ` , ` <code> ` , etc.) | 3 | ` components ` slot |
2626| Wrap the app in a provider (state, analytics, auth) | 4 | Eject ` Root ` |
27+ | Replace built-in icons (logo, GitHub, search, etc.) | — | Icon re-export |
2728| Completely replace a built-in component | 4 | Eject that component |
2829| Add a global floating component (back-to-top, chat widget) | — | ` globalUIComponents ` config |
2930| Control page layout structure (hide sidebar, blank page) | — | Frontmatter ` pageType ` |
@@ -139,6 +140,54 @@ export { DocFooter } from './components/DocFooter';
139140
140141---
141142
143+ ## Custom Icons
144+
145+ Rspress has 27 built-in icons used across the UI. You can replace any of them by re-exporting your own icon component with the same name — no ejection needed. This uses the same ` theme/index.tsx ` mechanism: your named export takes precedence over the wildcard re-export.
146+
147+ ** Icon type** : Each icon is a React component or a URL string:
148+
149+ ``` ts
150+ type Icon = React .FC <React .SVGProps <SVGSVGElement >> | string ;
151+ ```
152+
153+ ** Example 1** — Replace an icon with a custom SVG component:
154+
155+ ``` tsx
156+ // theme/index.tsx
157+ export * from ' @rspress/core/theme-original' ;
158+
159+ // Named export overrides the wildcard — replaces the GitHub icon site-wide
160+ export const IconGithub: React .FC <React .SVGProps <SVGSVGElement >> = (props ) => (
161+ <svg xmlns = " http://www.w3.org/2000/svg" viewBox = " 0 0 24 24" { ... props } >
162+ <path d = " M12 2C6.477 2 2 6.484 2 12.017c0 ..." fill = " currentColor" />
163+ </svg >
164+ );
165+ ```
166+
167+ ** Example 2** — Use an SVGR import:
168+
169+ ``` tsx
170+ // theme/index.tsx
171+ export * from ' @rspress/core/theme-original' ;
172+
173+ import CustomGithubIcon from ' ./icons/github.svg?react' ;
174+ export const IconGithub = CustomGithubIcon ;
175+ ```
176+
177+ ** Using ` SvgWrapper ` in MDX or custom components** :
178+
179+ ``` mdx
180+ import { SvgWrapper , IconGithub } from ' @rspress/core/theme' ;
181+
182+ <SvgWrapper icon = { IconGithub } width = { 24 } height = { 24 } />
183+ ```
184+
185+ ** Available icons** : ` IconArrowDown ` , ` IconArrowRight ` , ` IconClose ` , ` IconCopy ` , ` IconDeprecated ` , ` IconDown ` , ` IconEdit ` , ` IconEmpty ` , ` IconExperimental ` , ` IconExternalLink ` , ` IconFile ` , ` IconGithub ` , ` IconGitlab ` , ` IconHeader ` , ` IconJump ` , ` IconLink ` , ` IconLoading ` , ` IconMenu ` , ` IconMoon ` , ` IconScrollToTop ` , ` IconSearch ` , ` IconSmallMenu ` , ` IconSuccess ` , ` IconSun ` , ` IconTitle ` , ` IconWrap ` , ` IconWrapped ` etc.
186+
187+ > ** Source** : See the [ icons source] ( https://github.com/web-infra-dev/rspress/blob/main/packages/core/src/theme/icons.ts ) for default implementations.
188+
189+ ---
190+
142191## Global UI Components
143192
144193For components that should render on every page without theme overrides:
@@ -187,5 +236,6 @@ Fine-grained: set `navbar: false`, `sidebar: false`, `outline: false`, `footer:
187236- Custom theme guide: < https://rspress.rs/guide/basic/custom-theme >
188237- CSS variables: < https://rspress.rs/ui/vars >
189238- Layout component: < https://rspress.rs/ui/layout-components/layout >
239+ - Built-in icons: < https://rspress.rs/ui/icons/ >
190240- Built-in hooks: < https://rspress.rs/ui/hooks/ >
191241- CLI commands (eject): < https://rspress.rs/api/commands >
0 commit comments