react-jsonschema-form
react-jsonschema-form copied to clipboard
General question about the further development
Prerequisites
- [ x ] I have read the documentation;
Description
Hi there, first of all: thanks for the great work making forms less annoying. Currently I'm using this lib together with symfony/form.
As I mentioned here #1461 I'm currently developing a blueprintjs extension. Currently I got stuck on customizing for example the SchemaField, cause I think I'm refactoring some main parts of the code and I'm writing no extension, but a complete separated fork.
Second point I was stuck on was the i18n-thing - currently I'm using react-i18next with all in my projects. Currently there is no possibility to use for example translated labels or descriptions inside this project, so I need to rewrite again the SchemaField and for sure some other parts as well.
I know, this lib was developed for the kinto admin but it would be really great to have something like a defacto standard for rendering forms in the frontend, currently I don't think it's possible due to some hard-coded files (like the SchemaField).
So, what are your plans for this lib, are you going to add some features or is there any plan to make it complete customizable?
Thank you in advance, Dominik
Version
1.8.0
Hopefully the widgets, fields, templates, etc. available in withTheme
should be enough to completely customize rjsf to the level needed for themes -- what exactly were you trying to customize which wasn't possible without forking? You can override SchemaField
in withTheme
by passing an object such as {fields: {SchemaField: ...}}
.
Hopefully the widgets, fields, templates, etc. available in
withTheme
should be enough to completely customize rjsf to the level needed for themes -- what exactly were you trying to customize which wasn't possible without forking? You can overrideSchemaField
inwithTheme
by passing an object such as{fields: {SchemaField: ...}}
.
I'm overriding already the SchemaField and yes, everything can be overwritten by using withTheme HOC. My current problem is that there is lots of logic inside for example the SchemaField to collect everything what is needed. And as there is a work in progress for the field-components, I would need to regularly merge changes from the main-repo to stay up to date. This could be a nasty job, because especially the SchemaField is really fragmented.
Widgets otherwise can be defined very clean and encapsulated from the logic part. The same should be done for the other components where there are bootstrap-markups inside:
import React, { Component } from 'react';
import { InputGroup } from "@blueprintjs/core";
class TextWidget extends Component {
render() {
const { readonly, value, onChange, label } = this.props
return (
<InputGroup
label={label}
disabled={readonly}
defaultValue={value}
onChange={() => onChange(value)} />
);
}
}
export default TextWidget;
Summarized: It can be overridden everything with the HOC to create a theme, but I don't think this can be done in a clean way. And I think only in a clean way there will be themes coming (like blueprintjs/antd/extjs) from the community. Currently it's much more safe to just fork, customize and cherry pick important commits from the main-repo. Much better would be for me of course to add features to this lib, not making a new one. But this depends on what your plan is - if you were using components, like react-bootstrap it would be much easier to create themes, than just using markup.
@domhaas yeah, good point. I made a suggestion for how to resolve this over here: https://github.com/rjsf-team/react-jsonschema-form/issues/1222#issuecomment-511054781
Do you think that would work?
@domhaas yeah, good point. I made a suggestion for how to resolve this over here: #1222 (comment)
Do you think that would work?
@epicfaace I think this would be much better than the current implementation. Avoiding html-tags and create independant react-components should resolve the issue to overwrite for example the FieldTemplate completely.
Anyhow, I need some more time to think about it. Currently I got many ideas to optimize this library, for example also the layout-thing to achieve responsive layout options, which I think is really missing. Currently I'm using react-grid-system and it works like a charm, therefor I've added a new property to the schema "ui:layout":
"ui:layout": {
"sm": 12
"md": 6
}
I've recently updated my repo react-jsonschema-form-theme-blueprintjs and there's also a npm package: npm i react-jsonschema-form-theme-blueprintjs
Hoping to get our thoughts together to one repository.