diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index b5a74e460c..d530ca8922 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -652,13 +652,133 @@ The `in:` and `out:` directives are not bidirectional. An in transition will con {/if} ``` -* TODO parameters -* custom CSS transitions -* custom JS transitions -* deferred transitions -* events -* local +--- + +Like actions, transitions can have parameters. + +(The double `{{curlies}}` aren't a special syntax; this is an object literal inside an expression tag.) + +```html +{#if visible} +
+ The quick brown fox jumps over the lazy dog +
+{/if} +``` + +If a transition returns a function instead of a transition object, the function will be called in the next microtask. This allows multiple transitions to coordinate, making [crossfade effects](https://v3.svelte.technology/tutorial/deferred-transitions) possible. + +--- + +An element with transitions will dispatch the following events in addition to any standard DOM events: + +* `introstart` +* `introend` +* `outrostart` +* `outroend` + +```html +{#if visible} ++ Flies in and out +
+{/if} +``` + +--- + +Local transitions only play when the block they belong to is created or destroyed, *not* when parent blocks are created or destroyed. + +```html +{#if x} + {#if y} ++ fades in and out when x or y change +
+ ++ fades in and out only when y changes +
+ {/if} +{/if} +``` ### TODO