Skip to content

Darkmode #4466

@rufreakde

Description

@rufreakde

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    material-uimaterial-ui related theme issueneeds reproducible exampleMissing a link to a reproduction in the playground, CodeSandbox, JSFiddle, etc.question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions