From 67207d7daf49fb849e9f7a95fe5284699e40f215 Mon Sep 17 00:00:00 2001 From: p-sw Date: Sun, 4 Aug 2024 16:03:28 +0900 Subject: [PATCH] fix: use invalid message in context instead of children prop --- packages/react/components/Form.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react/components/Form.tsx b/packages/react/components/Form.tsx index b03ef3f..b5f7cfd 100644 --- a/packages/react/components/Form.tsx +++ b/packages/react/components/Form.tsx @@ -157,12 +157,12 @@ const [formErrorVariant, resolveFormErrorVariantProps] = vcn({ interface FormErrorProps extends VariantProps, AsChild, - ComponentPropsWithoutRef<"span"> {} + Omit, "children"> {} const FormError = forwardRef((props, ref) => { const [variantProps, otherPropsCompressed] = resolveFormErrorVariantProps(props); - const { asChild, children, ...otherPropsExtracted } = otherPropsCompressed; + const { asChild, ...otherPropsExtracted } = otherPropsCompressed; const item = useContext(FormItemContext); @@ -174,7 +174,7 @@ const FormError = forwardRef((props, ref) => { className={formErrorVariant(variantProps)} {...otherPropsExtracted} > - {children} + {item.invalid} ) : null; });