-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[RFC][Joy UI] Remove TextField
in favor of composition
#34176
Comments
TextField
with compositionTextField
in favor of composition
Hi, can I try this one?! |
Thanks for asking but I think we will have to wait for the decision first. |
I think that this could work as long as the abstractions terminology/structure is compatible with Material UI's one. At a high level, I would be amazed if we don't get a lot of people asking us to create a Text Field abstraction on top of the lower-level primitives once we remove it, but who knows? It might actually be interesting to experiment. In v1, I tried to promote the composable API https://v1.mui.com/demos/text-fields/#components but move the h2 lower in the page in the following major versions when I saw the Google Analytics demos use stats on this page 😁. |
This is the most important aspect of the solution for me. If the alternative can do this by default, then I'd be satisfied. |
Yes, it works the same. The only downside is that you have to write more code (3 components) instead of 1, the |
Great! I can add that I think this would be received well by my company engineering team. Those who are very comfortable would grunt at the loss of a succinct component, but I've fielded so many questions and misunderstandings about TextField and TextField vs FormLabel, Input, etc. that it would have been well worth it to everyone to never have dealt with the abstraction in the first place. One more thing I'd like to suggest is making Form*** components warn in the console if they can't find a |
From #34994, using |
Related to this discussion https://twitter.com/BrettThurs10/status/1591118613318369281 |
Jun, as we discussed, I made a draft PR for this issue. Feel free to skim through. Since Joy doesn't have API docs yet, should we at least have a documentation for Joy |
Is TextField still being removed? It remains in the package. |
Problems
The
TextField
is a wrapper ofFormLabel
,Input
, andFormHelperText
. It binds the id with ARIA to those components which reduce a lot of effort for developers.However, it becomes a pain when you need to pass props to the inner HTML input:
Hard to customize
To pass a prop to the HTML input, you have to do this:
Confusion
Take Material UI as an example, Joy UI would follow the same regardless of the final APIs for the TextField.
here is some confusion from the community about the API of the
TextField
:endAdornment
as a prop, but implementation requires it onInputProps
#31421TextField
inputProps
not passed to<input/>
#29525Proposal
Remove the
TextField
component and lean toward composition similar to Chakra UI.I think the removal of the
TextField
will clean up the confusion and hand over the customization to developers which sounds like a good strategy for us (as a maintainer).Advantages
TextField
should have (currently, thecomponentsProps
does not work)Textarea
,Select
, andAutocomplete
without creating new field components.Disadvantages
FormControl
for composition as well)The text was updated successfully, but these errors were encountered: