Page MenuHomePhabricator

Add required indicator to the TextInput component
Closed, DeclinedPublic

Description

Per the Design Style Guide, one of the use cases for the end icon is a required indicator. Instead of requiring library users to include the required icon, we should add a boolean required prop to TextInput that will add the end icon automatically.

Acceptance criteria
  • TextInput has a new prop called required that, when true, will add the required indicator as the end icon
  • Add this to the docs

Event Timeline

What happens if the TextInput is required but the user wants to have a different end icon?

  • Other end icon is used, no error
  • Required end icon is used, no error
  • Property validation error for conflicting options

@STHart this task is related with this other about designing the required/optional behavior for form field T306427

As I commented in the task, the proposal is to indicate only the optional fields instead of indicate the required ones with an asterisk:

After testing he use of required and optional fields, I would go with the proposal to indicate only the optional fields (view Figma here) to avoid too heavy forms with many required fields (e.g. Create Account) or forms in which there are only mandatory fields with asterisks everywhere (e.g. Log in).

Final proposal.png (1×3 px, 203 KB)

If we decide to move forward with this proposal we wouldn't need to add the required indicator to the TextInput component.

AnneT removed AnneT as the assignee of this task.

We decided not to use a required indicator in Codex. Instead, all fields should be assumed to be required by default, and the Field and Label components have an "optional" flag that allows you to provide a text label stating that a field is optional