FoodEase

Portal

Custom portal component for rendering content outside the normal DOM hierarchy.

Portal

The Portal component allows you to render children outside the normal DOM hierarchy, typically used for modals, overlays, or floating UI elements.

Installation

npx shadcn@latest add https://foodease-dev-registry.cap.reachcinema.io/r/v1/portal.json

Usage

import Portal from "@/components/ui/portal";

<Portal>
  <div>Your content here</div>
</Portal>

Props

PropTypeDefaultDescription
childrenReactNodeContent to render in the portal
idstring"app-keyboard-portal"DOM id for the portal host element
classNamestringOptional CSS class for the portal host
zIndexnumber2147483646z-index for stacking order

Example

<Portal id="modal-root" zIndex={9999}>
  <div className="modal">Modal content</div>
</Portal>

Implementation

See components/ui/portal.tsx for source code.

On this page