@@ -24,6 +24,10 @@ import type { FormErrors } from './types';
2424
2525type FormProps < TSchema extends z . ZodType < FormDataType > , TData extends z . TypeOf < TSchema > = z . TypeOf < TSchema > > = {
2626 [ key : `data-${string } `] : unknown ;
27+ additionalButtons ?: {
28+ left ?: React . ReactNode ;
29+ right ?: React . ReactNode ;
30+ } ;
2731 className ?: string ;
2832 content : FormContent < TData > ;
2933 fieldsFooter ?: React . ReactNode ;
@@ -41,6 +45,7 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
4145
4246// eslint-disable-next-line max-lines-per-function
4347const Form = < TSchema extends z . ZodType < FormDataType > , TData extends z . TypeOf < TSchema > = z . TypeOf < TSchema > > ( {
48+ additionalButtons,
4449 className,
4550 content,
4651 fieldsFooter,
@@ -173,6 +178,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
173178 ) }
174179 { fieldsFooter }
175180 < div className = "flex w-full gap-3" >
181+ { additionalButtons ?. left }
176182 { /** Note - aria-label is used for testing in downstream packages */ }
177183 < Button aria-label = "Submit" className = "block w-full" disabled = { readOnly } type = "submit" variant = "primary" >
178184 { submitBtnLabel ?? t ( 'form.submit' ) }
@@ -189,6 +195,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
189195 { t ( 'form.reset' ) }
190196 </ Button >
191197 ) }
198+ { additionalButtons ?. right }
192199 </ div >
193200 { Boolean ( rootErrors . length ) && < ErrorMessage error = { rootErrors } /> }
194201 </ form >
0 commit comments