white-label
БесплатноБез исполняемых скриптовНе проверенMUI multi-theme and white-label systems — nested ThemeProvider, dynamic theme switching, tenant-specific branding, and theme composition
от TheLobbi★ 22 звезды на GitHubОб этом скилле
MUI White-Label and Multi-Theme Systems
Nested ThemeProvider
MUI's ThemeProvider can be nested. Inner providers merge with or override the outer
theme. Use this to scope different visual treatments to different sections of the app.
import { ThemeProvider, createTheme } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Typography from '@mui/material/Typography';
const mainTheme = createTheme({
palette: {
primary: { main: '#1976d2' },
background: { default: '#fafafa' },
},
});
// Admin sidebar uses a dark theme, scoped to its subtree
const adminSidebarTheme = createTheme({
palette: {
mode: 'dark',
primary: { main: '#90caf9' },
background: { default: '#1e1e1e', paper: '#2d2d2d' },
},
});
export function AppShell() {
return (
<ThemeProvider theme={mainTheme}>
<CssBaseline />
<Box sx={{ display: 'flex' }}>
{/* Dark sidebar — scoped theme */}
<ThemeProvider theme={adminSidebarTheme}>
<Paper sx={{ width: 280, minHeight: '100vh', p: 2 }}>
<Typography variant="h6">Admin</Typography>
<Button variant="contained">Dashboard</Button>
</Paper>
</ThemeProvider>
{/* Main content — inherits mainTheme */}
<Box sx={{ flex: 1, p: 3 }}>
<Typography variant="h4">Welcome</Typography>
<Button variant="contained">Main Action</Button>
</Box>
</Box>
</ThemeProvider>
);
}
Nested Theme with Callback (Merge Instead of Replace)
Pass a function to ThemeProvider to receive the outer theme and merge selectively:
<ThemeProvider theme={mainTheme}>
<ThemeProvider
theme={(outerTheme) =>
createTheme({
...outerTheme,
palette: {
...outerTheme.palette,
primary: { main: '#e91e63' }, // override only primary
},
})
}
>
<Button variant="contained">Pink Button, rest of theme inherited</Button>
</ThemeProvider>
</ThemeProvider>
Dynamic Theme Loading
Load theme configuration from an API or database at runtime. This is the foundation of any white-label system.
import { ThemeProvider, createTheme, type ThemeOptions } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import CircularProgress from '@mui/material/CircularProgress';
import Box from '@mui/material/Box';
import { useState, useEffect, useMemo, type ReactNode } from 'react';
interface BrandConfig {
primaryColor: string;
secondaryColor: string;
fontFamily: string;
borderRadius: number;
logoUrl: string;
mode: 'light' | 'dark';
}
function buildThemeOptions(brand: BrandConfig): ThemeOptions {
return {
palette: {
mode: brand.mode,
primary: { main: brand.primaryColor },
secondary: { main: brand.secondaryColor },
},
typography: {
fontFamily: brand.fontFamily,
},
shape: {
borderRadius: brand.borderRadius,
},
};
}
async function fetchBrandConfig(tenantId: string): Promise<BrandConfig> {
const res = await fetch(`/api/tenants/${tenantId}/brand`);
if (!res.ok) throw new Error(`Failed to load brand config for ${tenantId}`);
return res.json();
}
interface DynamicThemeProviderProps {
tenantId: string;
children: ReactNode;
}
export function DynamicThemeProvider({ tenantId, children }: DynamicThemeProviderProps) {
const [brandConfig, setBrandConfig] = useState<BrandConfig | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
fetchBrandConfig(tenantId)
.then(setBrandConfig)
.catch((err) => setError(err.message));
}, [tenantId]);
const theme = useMemo(
() => (brandConfig ? createTheme(buildThemeOptions(brandConfig)) : null),
[brandConfig],
);
if (error) return <Box sx={{ p: 4, color: 'error.main' }}>Theme load failed: {error}</Box>;
if (!theme) {
return (
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}>
<CircularProgress />
</Box>
);
}
return (
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
</ThemeProvider>
);
}
Theme Composition
Use deepmerge (shipped with MUI as @mui/utils/deepmerge) to layer tenant
overrides on top of a base theme. This ensures tenants only override what they need
and inherit everything else.
import { createTheme, type ThemeOptions } from '@mui/material/styles';
import deepmerge from '@mui/utils/deepmerge';
// Shared base — every tenant gets this as the foundation
const baseThemeOptions: ThemeOptions = {
typography: {
fontFamily: '"Inter", "Helvetica", "Arial", sans-serif',
h1: { fontSize: '2.5rem', fontWeight: 700 },
h2: { fontSize: '2rem', fontWeight: 600 },
button: { textTransform: 'none', f
Установить white-label в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGlobGrepWriteEditFAQ
Что делает скилл white-label?
MUI multi-theme and white-label systems — nested ThemeProvider, dynamic theme switching, tenant-specific branding, and theme composition
Как установить скилл white-label?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл white-label запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic