close
  • English
  • Built-in icons theme-only

    When Rspress uses icons, it uses a SvgWrapper component to render icons. It supports icon as a URL or an svgr React component:

    type Icon = React.FC<React.SVGProps<SVGSVGElement>> | string;

    The following code is an example of how Rspress uses IconGithub:

    import { SvgWrapper, IconGithub } from '@rspress/core/theme-original';
    
    <SvgWrapper icon={IconGithub} width={24} height={24} />

    Usage

    When you want to replace Rspress built-in icons, use Custom Theme - Re-export for replacement.

    theme/index.tsx
    export { IconGithub } from './my-icons';
    export * from '@rspress/core/theme-original';

    All icons used by Rspress are as follows:

    import {
      SvgWrapper,
      IconArrowDown,
      IconArrowRight,
      IconClose,
      IconCopy,
      IconDeprecated,
      IconDown,
      IconEdit,
      IconEmpty,
      IconExperimental,
      IconExternalLink,
      IconFile,
      IconGithub,
      IconGitlab,
      IconHeader,
      IconJump,
      IconLoading,
      IconMenu,
      IconMoon,
      IconScrollToTop,
      IconSearch,
      IconSmallMenu,
      IconSuccess,
      IconSun,
      IconTitle,
      IconWrap,
      IconWrapped,
      IconLink,
    } from '@rspress/core/theme';
    
    export default () => {
      return (
        <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', fontSize: 12 }}>
          {[
            IconArrowDown,
            IconArrowRight,
            IconClose,
            IconCopy,
            IconDeprecated,
            IconDown,
            IconEdit,
            IconEmpty,
            IconExperimental,
            IconExternalLink,
            IconFile,
            IconGithub,
            IconGitlab,
            IconHeader,
            IconJump,
            IconLoading,
            IconMenu,
            IconMoon,
            IconScrollToTop,
            IconSearch,
            IconSmallMenu,
            IconSuccess,
            IconSun,
            IconTitle,
            IconWrap,
            IconWrapped,
            IconLink,
          ].map((Icon, idx) => (
            <SvgWrapper icon={Icon} key={idx} width={24} height={24} />
          ))}
        </div>
      );
    };