UNPKG

2.04 kBTypeScriptView Raw
1import * as React from 'react';
2import { DefaultTheme } from '@mui/system';
3import { CssThemeVariables } from './createThemeNoVars';
4type ThemeProviderCssVariablesProps = CssThemeVariables extends {
5 enabled: true;
6} ? {
7 /**
8 * The node for attaching the `theme.colorSchemeSelector`.
9 * @default document
10 */
11 colorSchemeNode?: Element | null;
12 /**
13 * If `true`, the provider creates its own context and generate stylesheet as if it is a root `ThemeProvider`.
14 */
15 disableNestedContext?: boolean;
16 /**
17 * If `true`, the style sheet for CSS theme variables won't be generated.
18 *
19 * This is useful for controlling nested ThemeProvider behavior.
20 * @default false
21 */
22 disableStyleSheetGeneration?: boolean;
23} : {};
24export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderCssVariablesProps {
25 children?: React.ReactNode;
26 theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
27 /**
28 * The document used to perform `disableTransitionOnChange` feature
29 * @default document
30 */
31 documentNode?: Document | null;
32 /**
33 * The default mode when the local storage has no mode yet,
34 * requires the theme to have `colorSchemes` with light and dark.
35 * @default 'system'
36 */
37 defaultMode?: 'light' | 'dark' | 'system';
38 /**
39 * The window that attaches the 'storage' event listener
40 * @default window
41 */
42 storageWindow?: Window | null;
43 /**
44 * localStorage key used to store application `mode`
45 * @default 'mui-mode'
46 */
47 modeStorageKey?: string;
48 /**
49 * localStorage key used to store `colorScheme`
50 * @default 'mui-color-scheme'
51 */
52 colorSchemeStorageKey?: string;
53 /**
54 * Disable CSS transitions when switching between modes or color schemes
55 * @default false
56 */
57 disableTransitionOnChange?: boolean;
58}
59export default function ThemeProvider<Theme = DefaultTheme>({ theme, ...props }: ThemeProviderProps<Theme>): React.JSX.Element;
60export {};
61
\No newline at end of file