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

field-error.ts

11 lines316 Bytes

1import { html, nothing } from 'lit'
2import type { AnyFieldApi } from '@tanstack/lit-form'
3​
4export function fieldError(field: AnyFieldApi) {
5 return html`<small
6 role=${field.meta.isInvalid ? 'alert' : nothing}
7 aria-live="polite"
8 >
9 ${field.errors.map((error) => error.message).join(', ')}
10 </small>`