Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wish] Theme only for subpages or subcomponents #219

Open
rafalzawadzki opened this issue Sep 16, 2023 · 1 comment
Open

[Wish] Theme only for subpages or subcomponents #219

rafalzawadzki opened this issue Sep 16, 2023 · 1 comment

Comments

@rafalzawadzki
Copy link

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 #203 or #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:

<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?

@merzoo
Copy link

merzoo commented Oct 17, 2023

i got same issue in next13.5.4 app dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants