@worktif/purei
Version:
Work TIF Material UI Theme Provider and Customization Suite for React applications with dark mode support and dynamic color schemes
22 lines (21 loc) • 1.4 kB
TypeScript
import * as React from 'react';
/**
* FormErrors is a functional React component that renders a list of error messages relevant to a specific form.
*
* This component is designed to handle validation errors that may occur during form submission or interaction.
* It supports rendering both form-specific errors derived from the form's value structure and custom error messages passed as props.
*
* FormErrors also utilizes localized labels for form fields and styles to provide a user-friendly display of error feedback.
*
* Props:
* - formValue (object[]): An array of form structures where each structure represents a form state. The component will extract error data from the specific index determined by `formIndex`.
* - messages (string[]): An optional array of additional string error messages to display.
* - formIndex (number): The index of the form within `formValue` that is being evaluated for errors. Defaults to 0.
*
* Behavior:
* - If the `formValue` is defined and contains errors at the specified `formIndex`, those errors are rendered.
* - If `messages` is provided, it appends those messages to the list of errors.
* - Each error renders with an optional field label, which is translated using an internationalization schema accessed via React context.
* - If there are no errors, the component returns `null`.
*/
export declare const FormErrors: React.FC<any>;