Ariakit
/

portal-lazy

The button is rendered at the end of the document.
import { Portal } from "@ariakit/react";
import { Suspense, lazy } from "react";
import "./style.css";
const Button = lazy(() =>
import("@ariakit/react/button").then((mod) => ({ default: mod.Button })),
);
export default function Example() {
return (
<Suspense fallback="Loading">
The button is rendered at the end of the document.
<Portal>
<Button className="button">Button</Button>
</Portal>
</Suspense>
);
}

Stay tuned

Join 1,000+ subscribers and receive monthly tips & updates on new Ariakit content.

No spam. Unsubscribe anytime. Read latest issue