React-jsonschema-form: UISchema classNames do not work with material-ui theme

Created on 1 May 2020  路  2Comments  路  Source: rjsf-team/react-jsonschema-form

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.

help wanted material-ui

Most helpful comment

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

All 2 comments

Related to #1647

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mfulton26 picture mfulton26  路  3Comments

n1k0 picture n1k0  路  3Comments

videni picture videni  路  3Comments

Eric24 picture Eric24  路  3Comments

FBurner picture FBurner  路  3Comments