SOLFIND
Web Lens
Portal home

EasyFormDialog | TypeDoc Example

https://typedoc.org/example/functions/EasyFormDialog.html • 16 KB fetched
Open original page


EasyFormDialog | TypeDoc Example TypeDoc Example Docs API GitHub Preparing search index... * EasyFormDialog Function EasyFormDialog * EasyFormDialog ( props : PropsWithChildren < EasyFormDialogProps > ) : ReactElement An example of a complex React component. A wrapper around ActionDialog that removes a lot of the boilerplate needed for dialogs that contain a form. interface ExampleProps { onSuccess ( responseData : number ): Promise < void > onClose (): void } export function Example ({ onSuccess , onClose , }: ExampleProps ): ReactElement { const { onChildValidChange , allFieldsValid } = useFieldValidity () const [ showValidation , setShowValidation ] = useState ( false ) const vProps = { showValidation , onValidChange: onChildValidChange } const [ myNumber , setMyNumber ] = useState ( '' ) async function submit () { await api . product . performOperation () return { responseData: parseInt ( myNumber ), } } return ( < EasyFormDialog title = "Enter a Number" submitButtonText = "Submit" formIsValid = { allFieldsValid } showValidation = { showValidation } onShowValidationChange = { setShowValidation } onSubmit = { submit } onSuccess = { onSuccess } onClose = { onClose } > < FormGroup label = "My number" > { ( id ) => ( < ValidatedInput id = { id } name = "myNumber" validators = { [ Validators . required (), Validators . integer ()] } value = { myNumber } onChange = { setMyNumber } { ... vProps } /> ) } </ FormGroup > </ EasyFormDialog > ) } Copy Parameters * props : PropsWithChildren < EasyFormDialogProps > Returns ReactElement * Defined in example/src/reactComponents.tsx:254 Settings Member Visibility * Protected * Inherited * External Theme OS Light Dark Docs API GitHub TypeDoc Example * Loading... Generated using TypeDoc

Links found on this page

  1. TypeDoc Example [direct]
  2. Docs [direct]
  3. API [direct]
  4. GitHub [direct]
  5. EasyFormDialog [direct]
  6. EasyFormDialogProps [direct]
  7. example/src/reactComponents.tsx:254 [direct]
  8. TypeDoc Example [direct]