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

Darkmode #4466

Closed
1 task done
rufreakde opened this issue Jan 24, 2025 · 2 comments
Closed
1 task done

Darkmode #4466

rufreakde opened this issue Jan 24, 2025 · 2 comments
Labels
material-ui material-ui related theme issue needs reproducible example Missing a link to a reproduction in the playground, CodeSandbox, JSFiddle, etc. question

Comments

@rufreakde
Copy link

Prerequisites

What theme are you using?

material-ui

What is your question?

How is it possible to enable material-ui 5s darkmode? I googled and also checked the documentation but could not find anything specifically.

Themeprovider does not seem to work when set around the Form component.

https://mui.com/material-ui/customization/dark-mode/#dark-mode-only

import { ThemeProvider, createTheme } from '@mui/material/styles'
import CssBaseline from '@mui/material/CssBaseline'
import { withTheme } from '@rjsf/core'
import { Theme } from '@rjsf/mui'
import validator from '@rjsf/validator-ajv8'
...
const textRootPath = 'rootPath'
const Form = withTheme(Theme)

const darkTheme = createTheme({
  palette: {
    mode: 'dark'
  }
})

....

          <ThemeProvider theme={darkTheme}>
            <CssBaseline />
            <Form
              key={new Date().getTime()}
              //className="readableBackground"
              children={true} // hide submit button
              schema={treeState.customDataHolder?.jsonSchema?.referenceData}
              uiSchema={{}}
              formData={{}}
              validator={validator}
              onChange={onFormChange}
              onSubmit={onSubmit}
              onError={customLog('errors')}
            />
          </ThemeProvider>
@rufreakde rufreakde added needs triage Initial label given, to be assigned correct labels and assigned question labels Jan 24, 2025
@nickgros
Copy link
Contributor

I can't reproduce this, here's a CodeSandbox with it working.

We will need more specific reproduction steps to identify if this is an issue in RJSF.

@nickgros nickgros added needs reproducible example Missing a link to a reproduction in the playground, CodeSandbox, JSFiddle, etc. material-ui material-ui related theme issue and removed needs triage Initial label given, to be assigned correct labels and assigned labels Jan 24, 2025
@rufreakde
Copy link
Author

mhm strange let me try to disable all css in my project and see what happens.

okay yeah it seems the default main.css from the electron project I created with vite seems to interfere somehow extremly with the theme!

Thanks for testing this out ticket can be closed after removing all css I at least saw darkmode working :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
material-ui material-ui related theme issue needs reproducible example Missing a link to a reproduction in the playground, CodeSandbox, JSFiddle, etc. question
Projects
None yet
Development

No branches or pull requests

2 participants