Svelte and SvelteKit 5 · Template syntax
Animate elements entering and leaving
Apply a built-in transition to elements added or removed by blocks.
<script>
import { fade } from "svelte/transition";
</script>
{#if visible}
<p transition:fade>Hello</p>
{/if}
Official Svelte and SvelteKit 5 documentation
More template syntax commands
- Show content conditionally
- Loop over a list
- Show an async result
- Bind form inputs
- Handle events
- Toggle classes
All template syntax commands · Svelte and SvelteKit 5 cheatsheet