forked from rjsf-team/react-jsonschema-form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubmitButton.tsx
36 lines (35 loc) · 800 Bytes
/
SubmitButton.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from "react";
import {
getSubmitButtonOptions,
FormContextType,
RJSFSchema,
StrictRJSFSchema,
SubmitButtonProps,
} from "@rjsf/utils";
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
*/
export default function SubmitButton<
T = any,
S extends StrictRJSFSchema = RJSFSchema,
F extends FormContextType = any
>({ uiSchema }: SubmitButtonProps<T, S, F>) {
const {
submitText,
norender,
props: submitButtonProps = {},
} = getSubmitButtonOptions<T, S, F>(uiSchema);
if (norender) {
return null;
}
return (
<div>
<button
type="submit"
{...submitButtonProps}
className={`btn btn-info ${submitButtonProps.className}`}
>
{submitText}
</button>
</div>
);
}