Closed FranciscoKloganB closed 4 months ago
@FranciscoKloganB
Hey mate,
I've kicked off a big initiative focused on form field components, starting with handling invalid states for regular inputs.
Regarding the Field
component, here's a simple approach I'm using now:
<Field.Root>
<Field.Label>Label</Field.Label>
<Field.Input asChild>
<Input />
</Field.Input>
<Field.HelperText>Some additional Info</Field.HelperText>
<Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
I'm also exploring and simplifying the API to something like this:
<TextField label="" helperText="" multiline={false} />
Visually, this should look like:
But I also want to support this style:
Looking forward to your thoughts when you get a chance.
I'm personally fan of the simplistic approach on top. Appreciate that it easily accept validation/error messages at the Form.Field
and the Form.Root
level.
The second stylistic approach is interesting and very unique in comparison. I can certainly image some applications that would appreciate the second version. However, on the project I'm working on I would use the second approach only for simple forms where I could anticipate the number of fields is limited, won't grow and, are tighly related. Like the example you gave.
Dunno if this what you were looking for!
Cheers
Hey I was about to start implementing a Form component on my project's lib and noticed
park-ui
already has aField
recipe which does much, if not all the heavy work regarding the styling. It's based on@ark/ui
Field, which makes it even better. However, I can not find it onpark-ui.com
.Can you link the docs?