Skip to content

ValidatedTextInput: automatically default label to the label in the field's yup schema #69

Description

@mturley

Currently, to get nice-looking validation errors we have to repeat all our field labels in two places: in the schema and on the form field itself.

Looking at the TS types for yup, we should be able to grab the label set in the schema's label() method by looking at schema.spec.label: https://github.com/jquense/yup/blob/master/src/schema.ts#L42

We can probably use this in ValidatedTextInput to automatically provide a default for the label prop so it will render the schema's label if the consumer doesn't pass one in.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions