question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UISchema classNames do not work with material-ui theme

See original GitHub issue

Prerequisites

Description

UISchema classNames do not seem to work with the material-ui theme.

Steps to Reproduce

See this simple sample: JSONSchema

{
  "properties": {
    "field": {
      "type": "string"
    }
  }
}

UISchema

{
  "classNames": "extraClass"
}

See the playgrounds

Expected behavior

extraClass like in the default html output:

<form class="rjsf">
 <div class="form-group field field-undefined  extraClass">
  <fieldset id="root">
   <div class="form-group field field-string">
    <label class="control-label" for="root">
     field
    </label>
    <input class="form-control" id="root" label="field" placeholder="" type="text" value="">
   </div>
  </fieldset>
 </div>
 <div>
  <button type="submit" class="btn btn-info">
   Submit
  </button>
 </div>
</form>

Actual behavior

No extraClass in the material-ui html output:

<form class="rjsf">
 <div class="MuiFormControl-root MuiFormControl-fullWidth">
  <div class="MuiGrid-root jss5 MuiGrid-container MuiGrid-spacing-xs-2">
   <div class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12" style="margin-bottom: 10px;">
    <div class="MuiFormControl-root MuiFormControl-fullWidth">
     <div class="MuiFormControl-root MuiFormControl-fullWidth">
      <div class="MuiFormControl-root MuiTextField-root">
       <label class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated" data-shrink="false" for="root" id="root-label">
        field
       </label>
       <div class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl">
        <input aria-invalid="false" id="root" name="" type="string" class="MuiInputBase-input MuiInput-input" value="">
       </div>
      </div>
     </div>
    </div>
   </div>
  </div>
 </div>
 <div>
  <button type="submit" class="btn btn-info">
   Submit
  </button>
 </div>
</form>

A simple code search shows no result for classnames in the path /packages/material-ui/src/.

Version

The current github pages version.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
hiitskirancommented, Jul 3, 2020

If providing field level classNames is not yet supported for material UI, is there a work around until support is avaialble?

3reactions
benjaminbourscommented, Jun 17, 2022

Wow it’s crazy such an important problem is still there for that long time! I’m gonna open a PR about it, I mean, it’s the basic of such a theme library, to at least support the basic features of the form generator itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Themes - react-jsonschema-form documentation
Using themes​​ To use a theme from a package, just import the <Form /> component from that package. For example, to use the...
Read more >
How to use react-jsonschema-form with material-ui?
A: Probably not. We use Bootstrap v3 and it works fine for our needs. We would like for react-jsonschema-form to support other frameworks,...
Read more >
react-jsonschema-materialui-forms - npm
Note: The CDN version does not embed react or react-dom . ... The uiSchema object accepts a classNames property for each field of...
Read more >
Fixing Material UI's ClassName Mismatch for React
React Application; @material-ui/core of version of at least 4.9 (I'm not sure if this will work for older versions but it doesn't hurt...
Read more >
material-ui-schema-form - npm package | Snyk
Learn more about material-ui-schema-form: package health score, popularity, ... and its maintainers don't seem to have an upgrade anywhere on their roadmap.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found