Theme
ImageComparison
Before/after image comparison slider
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 { ImageComparison } from '@dryui/ui';
</script>
<ImageComparison>Content</ImageComparison>Import options
Root package
ts
import { ImageComparison } from '@dryui/ui'Per-component subpath
ts
import { ImageComparison } from '@dryui/ui/image-comparison'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Default
svelte
<ImageComparison>
{#snippet before()}
<img src="/examples/image-comparison-before.svg" alt="Before" class="comparison-media" />
{/snippet}
{#snippet after()}
<img src="/examples/image-comparison-after.svg" alt="After" class="comparison-media" />
{/snippet}
</ImageComparison>Vertical
svelte
<ImageComparison orientation="vertical">
{#snippet before()}
<img src="/examples/image-comparison-before.svg" alt="Before" class="comparison-media" />
{/snippet}
{#snippet after()}
<img src="/examples/image-comparison-after.svg" alt="After" class="comparison-media" />
{/snippet}
</ImageComparison>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 |
|---|---|---|---|---|
position | number | 50 | — | ✓ |
orientation | horizontalvertical | 'horizontal' | — | — |
before | Snippet | — | ✓ | — |
after | Snippet | — | ✓ | — |
handle | Snippet | — | — | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.