Components

FieldError

Provides an error message that a form control can reference.

tsx
import { FieldError } from '@precursor/field';

Example

Release notes go to this address.

Enter a full email address.

tsx
import { Field, FieldDescription, FieldError } from '@precursor/field';
import Input from '@precursor/input';
import Label from '@precursor/label';
import { useId } from 'react';
export default function Example() {
    const id = useId();
    return (
        <Field>
            <Label htmlFor={id}>Review email</Label>
            <Input
                name="email"
                id={id}
                type="email"
                defaultValue="example.com"
                state="error"
                aria-invalid
                aria-describedby={id + '-hint ' + id + '-error'}
            />
            <FieldDescription id={id + '-hint'}>
                Release notes go to this address.
            </FieldDescription>
            <FieldError id={id + '-error'}>
                Enter a full email address.
            </FieldError>
        </Field>
    );
}

Props

FieldError props
PropTypeDefaultNotes
childrenRequiredReactNode——
idRequiredstring——