Theme

Start Here

Start from the smallest working snippet, then move to interactive examples and the full API contract below.

Styled quick start

Copy this entrypoint first. It includes the imports required to get the component on screen.

svelte
<script lang="ts">
  import '@dryui/ui/themes/default.css';
  import '@dryui/ui/themes/dark.css';
  import { Portal } from '@dryui/ui';
</script>

<Portal>Content</Portal>

Import options

Root package

ts
import { Portal } from '@dryui/ui'

Per-component subpath

ts
import { Portal } from '@dryui/ui/portal'

Customize

Use the interactive examples to see common variants, states, and composition patterns before building your own.

Render Content in document.body

svelte
<script lang="ts">
  import { Button, Portal } from '@dryui/ui';
  let show = $state(false);
</script>

<style>
  .overlay-card {
    position: fixed;
    inset-block-end: var(--dry-space-8);
    inset-inline-end: var(--dry-space-8);
    z-index: var(--docs-z-overlay);
    padding: var(--dry-space-4);
    background: var(--dry-color-surface);
    border: 1px solid var(--dry-color-border);
    border-radius: var(--dry-radius-md);
    box-shadow: var(--dry-shadow-lg);
  }
</style>

<Button onclick={() => show = !show}>Toggle Portal</Button>

{#if show}
  <Portal target="body">
    <div class="overlay-card">
      This content is rendered in &lt;body&gt;!
    </div>
  </Portal>
{/if}

Disabled Portal (renders inline)

Rendered in-place (portal disabled)

svelte
<Portal disabled>
  <p>Rendered in-place (portal disabled)</p>
</Portal>

Compose

The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.

Prop Type Default Required Bindable
target
string | HTMLElement
disabled
boolean
children
Snippet

Also accepts standard HTML attributes (class, style, id, etc.)