@liveblocks/react-ui
Version:
A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
28 lines (24 loc) • 699 B
JavaScript
"use client";
import { jsx } from 'react/jsx-runtime';
import { Slot } from '@radix-ui/react-slot';
import { forwardRef } from 'react';
import { createPortal } from 'react-dom';
const PORTAL_NAME = "Portal";
const Portal = forwardRef(
({ container = document?.body, asChild, ...props }, forwardedRef) => {
const Component = asChild ? Slot : "div";
return container ? createPortal(
/* @__PURE__ */ jsx(Component, {
"data-liveblocks-portal": "",
...props,
ref: forwardedRef
}),
container
) : null;
}
);
if (process.env.NODE_ENV !== "production") {
Portal.displayName = PORTAL_NAME;
}
export { Portal };
//# sourceMappingURL=Portal.js.map