Fade transition plugin for Svelte
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.eslintrc.json
.gitignore
CHANGELOG.md
LICENSE
README.md
package.json
rollup.config.js

README.md

svelte-transitions-fade

Fade transition plugin for Svelte. Demo

fade-hello

Usage

Recommended usage is via svelte-transitions, but you can use this module directly if you prefer. Note that it assumes an ES module or CommonJS environment.

Install with npm or yarn:

npm install --save svelte-transitions-fade

Then add the plugin to your Svelte component's exported definition:

<label>
  <input type='checkbox' bind:checked='visible'> visible
</label>

{#if visible}
  <!-- use `in`, `out`, or `transition` (bidirectional) -->
  <div transition:fade>hello!</div>
{/if}

<script>
  import fade from 'svelte-transitions-fade';

  export default {
    transitions: { fade }
  };
</script>

Parameters

You can specify delay and duration parameters, which default to 0 and 400 respectively:

<div in:fade='{delay: 250, duration: 1000}'>
  fades in slowly after a short delay
</div>

License

MIT