Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cuddly-planets-dig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/react-form': patch
---

Allow returning all other `ReactNode`s not just `JSX.Element` in the `render` function of `withForm` and `withFieldGroup`.
13 changes: 9 additions & 4 deletions packages/react-form/src/createFormHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import type {
FormOptions,
FormValidateOrFn,
} from '@tanstack/form-core'
import type { ComponentType, Context, JSX, PropsWithChildren } from 'react'
import type {
ComponentType,
Context,
PropsWithChildren,
ReactNode,
} from 'react'
import type { FieldComponent } from './useField'
import type { ReactFormExtendedApi } from './useForm'
import type { AppFieldExtendedReactFieldGroupApi } from './useFieldGroup'
Expand Down Expand Up @@ -241,7 +246,7 @@ export interface WithFormProps<
>
}
>,
) => JSX.Element
) => ReactNode
}

export interface WithFieldGroupProps<
Expand Down Expand Up @@ -278,7 +283,7 @@ export interface WithFieldGroupProps<
>
}
>,
) => JSX.Element
) => ReactNode
}

export function createFormHook<
Expand Down Expand Up @@ -515,7 +520,7 @@ export function createFormHook<
fields: TFields
}
>,
) => JSX.Element {
) => ReactNode {
return function Render(innerProps) {
const fieldGroupProps = useMemo(() => {
return {
Expand Down
Loading