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

field-error.ts

10 lines313 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 >${field.errors.map((error) => error.message).join('\n')}</small
9 >`