threlte logo
@threlte/extras

<PortalTarget>

A component that defines a target for a <Portal> component.

Although Portals are extremely helpful in certain situations, it can be hard to reason about them at times. It’s recommended to use them sparingly.

Example

ComponentA.svelte
<!-- Create a portal with the id "trail" -->
<T.Object3D>
  <PortalTarget id="trail" />
</T.Object3D>
ComponentB.svelte
<Portal id="trail">
  <!-- Use a portal with the id "trail -->
  <T.Mesh>
    <T.BoxGeometry />
    <T.MeshStandardMaterial color="red" />
  </T.Mesh>
</Portal>

Component Signature

Props

name
type
required
default

id
string
no
'default'