[]previous and next page

PortalProps

Props of Portal.

Props of Portal.

Import#

ts
import type { PortalProps } from "@shadow-js/web";

Signature#

ts
interface PortalProps {
  /**
   * The element that receives the content, or a function returning it (read reactively). A null
   * target, or a function that returns null or undefined, renders nothing and warns once in
   * development (`PORTAL_TARGET_MISSING`).
   * @default document.body (when the prop is omitted)
   */
  readonly mount?: Element | null | (() => Element | null | undefined);
  /**
   * Put the content in a shadow root of the mount, created once and reused. A portal with a shadow
   * root is not server-rendered; the browser creates it.
   * @default false
   */
  readonly useShadow?: boolean;
  /**
   * Reserved for namespace handling. Nodes are inserted as they were created, so the flag does not
   * change the output yet.
   * @default false
   */
  readonly isSVG?: boolean;
  /**
   * The content: a node, text, an array, or an accessor returning them.
   * @default undefined (nothing is rendered)
   */
  readonly children?: unknown;
}

Members#

Name Type Description
mount? readonly mount?: Element | null | (() => Element | null | undefined) The element that receives the content, or a function returning it (read reactively). A null target, or a function that returns null or undefined, renders nothing and warns once in development (PORTAL_TARGET_MISSING).
useShadow? readonly useShadow?: boolean Put the content in a shadow root of the mount, created once and reused. A portal with a shadow root is not server-rendered; the browser creates it.
isSVG? readonly isSVG?: boolean Reserved for namespace handling. Nodes are inserted as they were created, so the flag does not change the output yet.
children? readonly children?: unknown The content: a node, text, an array, or an accessor returning them.