Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

FieldError.tsx

13 lines330 Bytes

1import type { AnyFieldApi } from '@tanstack/preact-form'
2​
3interface FieldInfoProps {
4 field: AnyFieldApi
5}
6​
7export function FieldError({ field }: FieldInfoProps) {
8 return (
9 <small role={field.meta.isInvalid ? 'alert' : undefined} aria-live="polite">
10 {field.errors.map((e) => e.message).join('\n')}
11 </small>
12 )