Skip to content

Remove “form-group field field-object” classnames from SchemaField #2280

@NeslihanKolukisa

Description

@NeslihanKolukisa

Below is the custom template code I have given to the json schema form. For objects in the form schema, it automatically creates a divi with the form-group field field-object class and MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-3 class. I don't want these to happen. I want all items to be lined up side by side (MuiGrid-root MuiGrid-item MuiGrid-grid-xs-6). How can I do it.

const CustomTemplate = (oftProps: ObjectFieldTemplateProps):any => (
  <div>
    <Grid container spacing={getSpacing(3)}>
      {oftProps.properties.map((element) => {
        if ((element.content.props.schema.type === undefined && element.content.props.schema.$ref === undefined)
            || (element.content.props.schema.type !== undefined && element.content.props.schema.type !== 'object')
          || enumFieldControl(element)) {
          return <Grid item xs={getColumns(2)}><Paper>{element.content}</Paper></Grid>;
        }
        return <Hidden>{element.content}</Hidden>;
      })}
    </Grid>
  </div>
);

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions