fade
Parameters
Preview
Code
Imports (in script tag):import { fade } from "svelte/transition";
Attributes (for element):
transition:fade
Example component:
<script lang="ts">
import { fade } from "svelte/transition";
let show = true;
</script>
<button on:click={() => show = !show}>Toggle</button>
{#if show}
<div transition:fade class="bg-primary-500 w-32 h-32" />
{/if}
<style>
div {
background-color: #00f;
height: 8rem;
width: 8rem;
}
</style>
blur
Parameters
Preview
Code
Imports (in script tag):import { blur } from "svelte/transition";
Attributes (for element):
transition:blur
Example component:
<script lang="ts">
import { blur } from "svelte/transition";
let show = true;
</script>
<button on:click={() => show = !show}>Toggle</button>
{#if show}
<div transition:blur class="bg-primary-500 w-32 h-32" />
{/if}
<style>
div {
background-color: #00f;
height: 8rem;
width: 8rem;
}
</style>
fly
Parameters
Preview
Code
Imports (in script tag):import { fly } from "svelte/transition";
Attributes (for element):
transition:fly
Example component:
<script lang="ts">
import { fly } from "svelte/transition";
let show = true;
</script>
<button on:click={() => show = !show}>Toggle</button>
{#if show}
<div transition:fly class="bg-primary-500 w-32 h-32" />
{/if}
<style>
div {
background-color: #00f;
height: 8rem;
width: 8rem;
}
</style>
slide
Parameters
Select an axis
Preview
Code
Imports (in script tag):import { slide } from "svelte/transition";
Attributes (for element):
transition:slide
Example component:
<script lang="ts">
import { slide } from "svelte/transition";
let show = true;
</script>
<button on:click={() => show = !show}>Toggle</button>
{#if show}
<div transition:slide class="bg-primary-500 w-32 h-32" />
{/if}
<style>
div {
background-color: #00f;
height: 8rem;
width: 8rem;
}
</style>
scale
Parameters
Preview
Code
Imports (in script tag):import { scale } from "svelte/transition";
Attributes (for element):
transition:scale
Example component:
<script lang="ts">
import { scale } from "svelte/transition";
let show = true;
</script>
<button on:click={() => show = !show}>Toggle</button>
{#if show}
<div transition:scale class="bg-primary-500 w-32 h-32" />
{/if}
<style>
div {
background-color: #00f;
height: 8rem;
width: 8rem;
}
</style>