| 1 |
import Box from '@mui/material/Box'; |
| 2 |
import Button from '@mui/material/Button'; |
| 3 |
import { getSubmitButtonOptions, FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils'; |
| 4 |
|
| 5 |
/** The `SubmitButton` renders a button that represent the `Submit` action on a form |
| 6 |
*/ |
| 7 |
export default function SubmitButton< |
| 8 |
T = any, |
| 9 |
S extends StrictRJSFSchema = RJSFSchema, |
| 10 |
F extends FormContextType = any |
| 11 |
>({ uiSchema }: SubmitButtonProps<T, S, F>) { |
| 12 |
const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions<T, S, F>(uiSchema); |
| 13 |
if (norender) { |
| 14 |
return null; |
| 15 |
} |
| 16 |
return ( |
| 17 |
<Box marginTop={3}> |
| 18 |
<Button type='submit' variant='contained' color='primary' {...submitButtonProps}> |
| 19 |
{submitText} |
| 20 |
</Button> |
| 21 |
</Box> |
| 22 |
); |
| 23 |
} |