-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Material Renderer Inputs to be aware of Variant #1797
Comments
Hi @CarlosGomez-dev! Thanks for the feature request. In general this definitely makes sense, so if we could add this feature in a non-disruptive way then I'm definitely for it. Can you give a small example of what you're suggesting? If I understand correctly you would like to suggest using It's a little bit misleading in a way that we are not actually using Did you already implement an approach for your own renderer set? |
Hello @sdirix,
That is what I had in mind, default props is material-ui calls them. I took a deeper look and can see that
Seeing the discoverability issue above, this approach seems more user-friendly. This means I would implement this similarly to how the official TextInput handles it.
I haven't. I created a custom renderer set with the specific variant and style I needed, but a feature like this would be very useful as I could simply define a variant via |
Hi @CarlosGomez-dev, sounds good to me! I'll discuss with the team and come back to you next week. |
Hi @CarlosGomez-dev, we very much would like to see this feature. So if you have time a PR is very welcomed! Regarding the implementation we're wondering whether it should be implemented by determining the appropriate Input variant component in |
I would love this ❤️ . Are you still working on this @CarlosGomez-dev ? |
I just bumped in this issue as well. Naively I assumed simply adjusting the default properties in MUI theme would do the trick. I saw however that JSONForms uses lower level components, like I however do not have any insight why the lower level components were used. @sdirix is there some specific reason for that? I have three options:
I would prefer contributing but only if that is in alignment with the project. |
Hi! The use of lower level inputs has historical reasons. Originally the We are definitely willing to accept changes here. Feel free to contribute using the approach outlined above In case you want to go the full way and replace all invocations of Note that we require test cases for all contributions, especially ones which change a lot of the render output ;) |
I see in the approach outlined above you guys discussed a custom config to the JSONForms directly, right? Effectively a custom TextField is created in JSONForms library, so I guess using the So what I could do is reverse engineer the Something like: const { ..., variant = 'standard' } = useThemeProps({
props: props as ControlProps & WithInput & TextFieldProps,
name: 'MuiTextField',
});
const variantComponent = {
standard: Input,
filled: FilledInput,
outlined: OutlinedInput,
};
const VariantComponent = variantComponent[variant];
...
return (
<FormControl
...
variant={variant}
>
<InnerComponent
{...props}
id={id + '-input'}
isValid={isValid}
visible={visible}
VariantComponent={VariantComponent}
/>
</FormControl>
) |
@klemenoslaj I started on this today but would really like more insight into what you were thinking. I'm pretty new to JSONForms and I'm not quite sure how you would use |
Agreed, this tool looks wonderful, and I don't think we can use it without the ability to configure MUI a little bit more |
@sdirix Is someone working on this issue? If not, I am willing to provide a PR which would leverage MUI's theme provider setting for variant. |
Hi @sebastianfrey, so you would do the work in |
@sdirix, yes, as suggested in the linked comment I would leverage |
Extend the react material renderers to be aware of MUI's input variant in the theme. - Extend input controls to be aware of the configured variant and use it - Extend input renderers to set the variant on the form control - Extend react material example with a variant selection dropdown Fix #1797
Is your feature request related to a problem? Please describe.
When using the material renderers, it would be nice to have the option to use the different material-ui input variants (
standard
,filled
,outlined
).Currently the material renderers are implemented using the
Input
component with no option to change the variant. That means you have to implement custom renderers if you want to use other variants.Describe the solution you'd like
The ideal solution would be updating the material renderers to take into consideration variants declared in a custom material theme provided to the JsonForms component, that way you can use material-ui's built-in theme support to build a custom theme and material renderers would choose the appropriate variant (or the
standard
variant if no custom theme is defined).Describe alternatives you've considered
There's two alternatives by implementing custom renderers:
Input
component to the variant you want. This means you now how to keep track of changes to source for this renderer.Framework
React
RendererSet
Material
Additional context
If the team agrees this would be a good feature to implement, I'm willing to work on it and submit a PR.
The text was updated successfully, but these errors were encountered: