Use case:
Create a customisable widget. Have a dashboard with a single default theme, but the themes inside widgets to be changeable.
For example in pseudocode:
<ThemeProvider forceTheme='light'>
<Dashboard />
<ThemeProvider forceTheme='dark'>
<Widget /> // ❌ <-- This does not work; both dashboard and widget will have the same theme
</ThemeProvider>
</ThemeProvider>
The same applies to pages and layouts within - it's impossible to nest themes or even make only one part of your app themable. For example:
<>
<Dashboard /> // ❌ <-- This does not work; the dashboard will have dark theme even though it's out of scope
<ThemeProvider forceTheme='dark'>
<Page />
</ThemeProvider>
</>
Any idea if this is possible at all or requires a custom solution?
Currently the
ThemeProvider
does not scope themes to its children, so themes apply to the whole document. This makes it very cumbersome to exclude some pages from theming (only with workarounds like https://github.com/pacocoursey/next-themes/issues/203 or https://github.com/pacocoursey/next-themes/issues/187) and impossible to theme specific component trees.Use case: Create a customisable widget. Have a dashboard with a single default theme, but the themes inside widgets to be changeable.
For example in pseudocode:
The same applies to pages and layouts within - it's impossible to nest themes or even make only one part of your app themable. For example:
Any idea if this is possible at all or requires a custom solution?