MCPcopy
hub / github.com/system-ui/theme-ui / ThemeProvider

Function ThemeProvider

packages/theme-provider/src/index.tsx:61–85  ·  view source on GitHub ↗
({
  theme,
  children,
})

Source from the content-addressed store, hash-verified

59
60/** @deprecated ThemeProvider is now called ThemeUIProvider to reduce confusion with Emotion */
61export const ThemeProvider: React.FC<ThemeProviderProps> = ({
62 theme,
63 children,
64}) => {
65 React.useEffect(() => {
66 if (process.env.NODE_ENV !== 'production') {
67 console.warn(
68 '[theme-ui] The export ThemeProvider is deprecated and is now called ThemeUIProvider to reduce confusion with Emotion. Please update your import; ThemeProvider will be removed in a future version.'
69 )
70 }
71 }, [])
72
73 const outer = useThemeUI()
74
75 const isTopLevel = outer === __themeUiDefaultContextValue
76
77 return (
78 <CoreProvider theme={theme}>
79 <ColorModeProvider>
80 {isTopLevel && <RootStyles />}
81 {children}
82 </ColorModeProvider>
83 </CoreProvider>
84 )
85}

Callers

nothing calls this directly

Calls 1

useThemeUIFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…