Skip to content

Commit

Permalink
feat(validatedtextinput): default field label to label defined in sch…
Browse files Browse the repository at this point in the history
…ema if present (#85)

If the yup schema of a text field contains a `.label()` (needed for good error messages),
ValidatedTextInput will use it as a default for the `label` prop so the consumer doesn't have to
duplicate it.
  • Loading branch information
mturley authored Feb 3, 2022
1 parent 2beb616 commit dd4759b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/ValidatedTextInput/ValidatedTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface IValidatedTextInputProps
export const ValidatedTextInput: React.FunctionComponent<IValidatedTextInputProps> = ({
field,
component = TextInput,
label,
label = field.schema.describe().label,
fieldId,
isRequired,
type = 'text',
Expand Down

0 comments on commit dd4759b

Please sign in to comment.