UNPKG

react-formal

Version:

Classy HTML form management for React

40 lines (39 loc) 1.33 kB
import PropTypes from 'prop-types'; import React, { ElementType } from 'react'; export interface FormSubmitProps<TAs extends ElementType = any> { as?: TAs; onClick?: (...args: any[]) => any; triggers?: string[]; } /** * A Form submit button, for triggering validations for the entire form or specific fields. * * @memberof Form */ declare function Submit<TAs extends ElementType = 'button'>(props: FormSubmitProps<TAs> & Omit<React.ComponentPropsWithoutRef<TAs>, 'triggers' | 'as'>): JSX.Element; declare namespace Submit { var propTypes: { /** * Specify particular fields to validate in the related form. If empty the entire form will be validated. */ triggers: PropTypes.Requireable<string[]>; /** * Control the rendering of the Form Submit component when not using * the render prop form of `children`. * * ```jsx static * <Form.Submit as={MyButton}> * Submit * </Form.Submit> * ``` */ as: PropTypes.Requireable<PropTypes.ReactComponentLike>; /** * A string or array of event names that trigger validation. * * @default 'onClick' */ onClick: PropTypes.Requireable<(...args: any[]) => any>; }; } export default Submit;