Skip to content
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

TextField component #228

Open
aldeed opened this issue Aug 16, 2018 · 1 comment
Open

TextField component #228

aldeed opened this issue Aug 16, 2018 · 1 comment

Comments

@aldeed
Copy link
Contributor

aldeed commented Aug 16, 2018

TextField

I propose that we create a TextField component, which renders this:

<Field>
  <TextInput />
  <ErrorsBlock />
</Field>

The props will be a combination of the props for all of those components it renders. It will get Field, TextInput, and ErrorsBlock from its components prop (components context).

For those familiar with autoform, this is similar to the quickField idea in that package.

There are 4 good reasons to make this and use it:

  1. Faster development, less to type
  2. UI consistency, there will be less variation in how each developer makes a field.
  3. Client bundle size. If making these blocks dynamically, there is less code to send down to the client.
  4. This component can handle making unique IDs to properly implement htmlFor on the label.

I think this should be limited to TextInput. We can duplicate it to make similar PhoneNumberField, NumberField, SelectField, etc.

@Vanshii21
Copy link

Ya, I think you right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants