MCPcopy Create free account
hub / github.com/TanStack/devtools / ThemeContextProvider

Function ThemeContextProvider

packages/devtools-ui/src/components/theme.tsx:17–30  ·  view source on GitHub ↗
(props: {
  children: JSX.Element
  theme: TanStackDevtoolsTheme
})

Source from the content-addressed store, hash-verified

15 setTheme: (theme: TanStackDevtoolsTheme) => void
16}
17const ThemeContext = createContext<ThemeContextValue>()
18
19export const ThemeContextProvider = (props: {
20 children: JSX.Element
21 theme: TanStackDevtoolsTheme
22}) => {
23 // Follows `props.theme`, and `setTheme` overrides it until the prop changes.
24 const [theme, setTheme] = createSignal<TanStackDevtoolsTheme>(
25 () => props.theme,
26 )
27 let container: HTMLSpanElement | undefined
28 onSettled(() => {
29 if (container) ensureDevtoolsStyles(container.ownerDocument)
30 })
31 return (
32 <ThemeContext value={{ theme, setTheme }}>
33 <span ref={container} style={{ display: 'contents' }}>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected