import * as React from 'react'; import { type BaseUIGenericEventDetails } from "../utils/createBaseUIEventDetails.js"; import { REASONS } from "../utils/reasons.js"; import type { BaseUIComponentProps } from "../utils/types.js"; import { FormContext } from "./FormContext.js"; /** * A native form element with consolidated error handling. * Renders a `
` element. * * Documentation: [Base UI Form](https://base-ui.com/react/components/form) */ export declare const Form: { = Record>(props: Form.Props & { ref?: React.Ref; }): React.JSX.Element; }; export type FormSubmitEventReason = typeof REASONS.none; export type FormSubmitEventDetails = BaseUIGenericEventDetails; export interface FormState {} export interface FormProps = Record> extends BaseUIComponentProps<'form', Form.State> { /** * Determines when the form should be validated. * The `validationMode` prop on `` takes precedence over this. * * - `onSubmit` (default): validates the field when the form is submitted, afterwards fields will re-validate on change. * - `onBlur`: validates a field when it loses focus. * - `onChange`: validates the field on every change to its value. * * @default 'onSubmit' */ validationMode?: FormValidationMode; /** * Validation errors returned externally, typically after submission by a server or a form action. * This should be an object where keys correspond to the `name` attribute on ``, * and values correspond to error(s) related to that field. */ errors?: FormContext['errors']; /** * Event handler called when the form is submitted. * `preventDefault()` is called on the native submit event when used. */ onFormSubmit?: (formValues: FormValues, eventDetails: Form.SubmitEventDetails) => void; } export type FormValidationMode = 'onSubmit' | 'onBlur' | 'onChange'; export declare namespace Form { type Props = Record> = FormProps; type State = FormState; type ValidationMode = FormValidationMode; type SubmitEventReason = FormSubmitEventReason; type SubmitEventDetails = FormSubmitEventDetails; type Values = Record> = FormValues; }