Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

rspress-custom-theme

БесплатноБез исполняемых скриптовНе проверен

Customize Rspress v2 themes with CSS variables, class overrides, Layout slots, icons, or component ejection.

rstackjsот rstackjs★ 101 звезда на GitHub

Об этом скилле

Rspress custom theme

Guide for customizing Rspress (v2) themes. Rspress offers four levels of customization, from lightest to heaviest. Always prefer the lightest approach that meets the requirement — lighter approaches are more maintainable and survive Rspress upgrades.

Workflow

  1. Understand the user's goal — what do they want to change? (colors, layout, inject content, replace a component entirely?)
  2. Pick the right level using the decision flow below
  3. Set up theme/index.tsx if needed (Levels 1A, 3, 4 all need it)
  4. Implement following the patterns in this skill and reference files
  5. Verify the user's Rspress version is v2 (imports use @rspress/core/* not rspress/*)

Decision flow

User wants to... Level Approach
Change brand colors, fonts, spacing, shadows 1 CSS variables
Adjust a specific component's style (borders, padding, etc.) 2 BEM class overrides
Add content around existing components (banners, footers, logos) 3 Layout slots (wrap)
Override MDX rendering (custom <h1>, <code>, etc.) 3 components slot
Wrap the app in a provider (state, analytics, auth) 4 Eject Root
Replace built-in icons (logo, GitHub, search, etc.) — Icon re-export
Completely replace a built-in component 4 Eject that component
Add a global floating component (back-to-top, chat widget) — globalUIComponents config
Control page layout structure (hide sidebar, blank page) — Frontmatter pageType

theme/index.tsx — The entry point

Levels 1A, 3, and 4 all require a theme/index.tsx file in the project root (sibling to docs/). This is the single entry point for all theme customizations:

project/
├── docs/
├── theme/
│   ├── index.tsx        # Theme entry — re-exports + overrides
│   ├── index.css         # CSS variable / BEM overrides (optional)
│   └── components/       # Ejected components (Level 4)
└── rspress.config.ts

Minimal setup:

// theme/index.tsx
import './index.css'; // optional
export * from '@rspress/core/theme-original';

Critical import rule: Inside theme/ files, import built-in theme components and runtime values from @rspress/core/theme-original. Rspress resolves @rspress/core/theme to your own theme/index.tsx, so importing those values there can create circular imports. In docs/ MDX files, @rspress/core/theme correctly points to your custom theme.

For types, use the public entry point that exports the type in your installed Rspress version. import type is erased during compilation and does not create a runtime circular import. Built-in component props such as RootProps are exported by @rspress/core/theme-original; configuration types such as UserConfig are exported by @rspress/core. If a component's props type is not exported, infer it with ComponentProps<typeof OriginalComponent> from React.


Level 1: CSS variables

Override CSS custom properties for brand colors, backgrounds, text, code blocks, and more.

Option A — theme/index.css (use when you also have component overrides in theme/index.tsx):

/* theme/index.css */
:root {
  --rp-c-brand: #7c3aed;
  --rp-c-brand-light: #8b5cf6;
  --rp-c-brand-dark: #6d28d9;
}
.dark {
  --rp-c-brand: #a78bfa;
}

Option B — globalStyles (use when you only need CSS changes, no component overrides):

// rspress.config.ts
export default defineConfig({
  globalStyles: path.join(__dirname, 'styles/custom.css'),
});

Full variable list: Read references/css-variables.md for all available CSS variables with light/dark defaults.


Level 2: BEM class overrides

All built-in components follow BEM naming: .rp-[component]__[element]--[modifier].

Common targets: .rp-nav, .rp-link, .rp-tabs, .rp-codeblock, .rp-codeblock__title, .rp-nav-menu__item--active.

Use these in your CSS file for targeted style changes when CSS variables aren't granular enough.


Level 3: wrap (Layout Slots)

Inject content at specific positions in the layout without replacing built-in components. Override Layout in theme/index.tsx:

// theme/index.tsx
import { Layout as OriginalLayout } from '@rspress/core/theme-original';
export * from '@rspress/core/theme-original';

export function Layout() {
  return (
    <OriginalLayout beforeNavTitle={<MyLogo />} bottom={<CustomFooter />} />
  );
}

Use runtime hooks inside slot components — import from @rspress/core/runtime: useDark(), useLang(), useVersion(), usePage(), useSite(), useFrontmatter()

Полный SKILL.md на GitHub

Установить rspress-custom-theme в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/css-variables.mdreferences/eject-components.mdreferences/layout-slots.md

FAQ

Что делает скилл rspress-custom-theme?

Customize Rspress v2 themes with CSS variables, class overrides, Layout slots, icons, or component ejection.

Как установить скилл rspress-custom-theme?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл rspress-custom-theme запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить rspress-custom-theme с