Overlay

Slideover

A slide-in panel from any edge of the screen for quick actions, forms, or navigation. Supports all four sides, inset mode, and customizable close behavior.

Playground

Experiment with different props in real-time.

Basic Usage

Import and use the Slideover component with bind:open, a title, and description.

<script lang="ts">
  import { Slideover, Button } from 'sv5ui';

  let open = $state(false);
</script>

<Button label="Open Slideover" onclick={() => (open = true)} />

<Slideover
  bind:open
  title="Basic Slideover"
  description="This is a simple slideover panel."
>
  {#snippet body()}
    <p>This is the body content of the slideover.</p>
  {/snippet}
</Slideover>

With Footer

Add action buttons using the footer snippet.

<script lang="ts">
  import { Slideover, Button } from 'sv5ui';

  let open = $state(false);
</script>

<Button label="Open Slideover" onclick={() => (open = true)} />

<Slideover
  bind:open
  title="Edit Profile"
  description="Make changes to your profile here."
>
  {#snippet body()}
    <p>Form fields go here...</p>
  {/snippet}

  {#snippet footer()}
    <Button variant="outline" color="surface" label="Cancel" onclick={() => (open = false)} />
    <Button label="Save Changes" onclick={() => (open = false)} />
  {/snippet}
</Slideover>

Sides

Use the side prop to control which edge the slideover appears from.

<Slideover side="right" title="Right" bind:open>...</Slideover>
<Slideover side="left" title="Left" bind:open>...</Slideover>
<Slideover side="top" title="Top" bind:open>...</Slideover>
<Slideover side="bottom" title="Bottom" bind:open>...</Slideover>

Inset

Enable the inset prop for a slideover with margins and rounded corners.

<script lang="ts">
  import { Slideover, Button } from 'sv5ui';

  let open = $state(false);
</script>

<Button label="Open Inset" onclick={() => (open = true)} />

<Slideover
  bind:open
  title="Inset Slideover"
  description="Displayed with inset margins and rounded corners."
  inset
>
  {#snippet body()}
    <p>This slideover has inset margins and rounded corners.</p>
  {/snippet}
</Slideover>

Non-dismissible

Set dismissible={false} to prevent closing by clicking outside or pressing Escape.

<script lang="ts">
  import { Slideover, Button } from 'sv5ui';

  let open = $state(false);
</script>

<Button label="Open Non-dismissible" onclick={() => (open = true)} />

<Slideover
  bind:open
  title="Important"
  dismissible={false}
>
  {#snippet body()}
    <p>This slideover cannot be closed by clicking outside or pressing Escape.</p>
  {/snippet}

  {#snippet footer()}
    <Button label="I Understand" onclick={() => (open = false)} />
  {/snippet}
</Slideover>

UI Slots

Use the ui prop to override classes on specific internal elements of the Slideover.

SlotDescription
overlayBackdrop behind the slideover — controls background color and opacity
contentMain slideover container — controls size, position, background
headerTop section containing title and description — controls layout and spacing
wrapperWraps the title and description text — controls text layout
titleTitle text — controls font size, weight, color
descriptionDescription text below title — controls font size and opacity
bodyMain content area — controls padding and overflow behavior
footerBottom section for actions — controls layout, gap, and alignment
closeClose button positioning — controls position and size

Snippets

Use Svelte 5 snippets to customize specific parts of the Slideover.

SnippetTypeDescription
childrenSnippetTrigger element — clicking opens the slideover
contentSnippetCustom content replacing the entire default layout
headerSnippetCustom header section
titleSlotSnippetCustom title content — overrides title prop
descriptionSlotSnippetCustom description content — overrides description prop
bodySnippetMain body content area
footerSnippetFooter area for action buttons
closeSlotSnippetCustom close button — replaces default close icon

Props

PropTypeDefault
openbooleanfalse
onOpenChange(open: boolean) => void-
titlestring-
descriptionstring-
side'top' | 'right' | 'bottom' | 'left''right'
overlaybooleantrue
transitionbooleantrue
insetbooleanfalse
closeboolean | SlideoverClosePropstrue
dismissiblebooleantrue
trapFocusbooleantrue
preventScrollbooleantrue
portalbooleantrue
classstring-
uiRecord<Slot, Class>-