Skip to content

Commit c98db6c

Browse files
committed
fix: add customStyles option to Form
1 parent 4731ca5 commit c98db6c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/Form/Form.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
3131
};
3232
className?: string;
3333
content: FormContent<TData>;
34+
customStyles?: {
35+
resetBtn?: string;
36+
submitBtn?: string;
37+
};
3438
fieldsFooter?: React.ReactNode;
3539
id?: string;
3640
initialValues?: PartialNullableFormDataType<NoInfer<TData>>;
@@ -49,6 +53,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
4953
additionalButtons,
5054
className,
5155
content,
56+
customStyles,
5257
fieldsFooter,
5358
id,
5459
initialValues,
@@ -164,7 +169,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
164169
</Heading>
165170
)}
166171
{fieldGroup.description && (
167-
<p className="text-sm italic leading-tight text-muted-foreground">{fieldGroup.description}</p>
172+
<p className="text-muted-foreground text-sm leading-tight italic">{fieldGroup.description}</p>
168173
)}
169174
</div>
170175
<FieldsComponent
@@ -194,7 +199,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
194199
{/** Note - aria-label is used for testing in downstream packages */}
195200
<Button
196201
aria-label="Submit"
197-
className="flex w-full items-center justify-center gap-2"
202+
className={cn('flex w-full items-center justify-center gap-2', customStyles?.submitBtn)}
198203
disabled={readOnly || isSuspended}
199204
type="submit"
200205
variant="primary"
@@ -218,7 +223,7 @@ const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TS
218223
{resetBtn && (
219224
<Button
220225
aria-label="Reset"
221-
className="block w-full"
226+
className={cn('block w-full', customStyles?.resetBtn)}
222227
disabled={readOnly}
223228
type="button"
224229
variant="secondary"

0 commit comments

Comments
 (0)