Skip to content

Commit

Permalink
fix: add error span (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
cliu02 authored Oct 10, 2023
1 parent 1fe35ac commit 5e9a989
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/forms/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ const Field = (props: FieldProps) => {
{isRadioOrCheckbox && label}
</div>
{props.subNote && <p className="field-sub-note">{props.subNote}</p>}
{props.errorMessage && (
{props.errorMessage ? (
<ErrorMessage id={`${idOrName}-error`} error={props.error}>
{props.errorMessage}
</ErrorMessage>
) : (
<span id={`${idOrName}-error`}></span>
)}
</div>
)
Expand Down

0 comments on commit 5e9a989

Please sign in to comment.