How It Works
When enabled, the content will move from the source to the target element.
Anatomy
Here’s an overview of how the Portal component is structured in code:
import { Portal } from '@skeletonlabs/skeleton-react';
export default function Anatomy() {
return <Portal>{/* Content */}</Portal>;
}<script lang="ts">
import { Portal } from '@skeletonlabs/skeleton-svelte';
</script>
<Portal>
<!-- Content -->
</Portal>API Reference
Root
| Prop | Default | Type |
|---|---|---|
disabled | false | boolean | undefined If true, the portal functionality is disabled and children are rendered in place. |
target | document.body | HTMLElement | undefined The HTML element to which the portal content will be appended. |
children | — | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...> | null |
Root
| Prop | Default | Type |
|---|---|---|
disabled | false | boolean | undefined If true, the portal functionality is disabled and children are rendered in place. |
target | document.body | HTMLElement | undefined The HTML element to which the portal content will be appended. |
children | — | Snippet<[]> The default slot content to be rendered within the component. |