Skip to content

Commit c83d578

Browse files
committed
feat(portal): ConditionalPortal supports ReactNode children
1 parent 74cee51 commit c83d578

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/portal/src/ConditionalPortal.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReactElement } from "react";
1+
import type { ReactElement, ReactNode } from "react";
22

33
import type { PortalInto } from "./getContainer";
44
import { Portal } from "./Portal";
@@ -27,8 +27,10 @@ export interface RenderConditionalPortalProps {
2727
export interface ConditionalPortalProps extends RenderConditionalPortalProps {
2828
/**
2929
* This children to render.
30+
*
31+
* @remarks \@since 4.0.0 Allows `ReactNode` instead of `ReactElement | null`
3032
*/
31-
children: ReactElement | null;
33+
children: ReactNode;
3234
}
3335

3436
/**
@@ -41,9 +43,9 @@ export function ConditionalPortal({
4143
portalInto,
4244
portalIntoId,
4345
children,
44-
}: ConditionalPortalProps): ReactElement | null {
46+
}: ConditionalPortalProps): ReactElement {
4547
if (!portal && !portalInto && !portalIntoId) {
46-
return children;
48+
return <>{children}</>;
4749
}
4850

4951
return (

0 commit comments

Comments
 (0)