docs: add crosslinks (#17663)

pull/17653/head
Rich Harris 3 months ago committed by GitHub
parent 67c4a38117
commit f09785424b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,5 +1,6 @@
---
title: $state
tags: rune-state
---
The `$state` rune allows you to create _reactive state_, which means that your UI _reacts_ when it changes.

@ -1,5 +1,6 @@
---
title: $derived
tags: rune-derived
---
Derived state is declared with the `$derived` rune:

@ -1,5 +1,6 @@
---
title: $effect
tags: rune-effect
---
Effects are functions that run when state updates, and can be used for things like calling third-party libraries, drawing on `<canvas>` elements, or making network requests. They only run in the browser, not during server-side rendering.

@ -1,5 +1,6 @@
---
title: $props
tags: rune-props
---
The inputs to a component are referred to as _props_, which is short for _properties_. You pass props to components just like you pass attributes to elements:

@ -1,5 +1,6 @@
---
title: $inspect
tags: rune-inspect
---
> [!NOTE] `$inspect` only works during development. In a production build it becomes a noop.

@ -1,5 +1,6 @@
---
title: {#if ...}
tags: template-if
---
```svelte

@ -1,5 +1,6 @@
---
title: {#each ...}
tags: template-each
---
```svelte

@ -1,5 +1,6 @@
---
title: {#key ...}
tags: template-key
---
```svelte

@ -1,5 +1,6 @@
---
title: {#await ...}
tags: template-await
---
```svelte

@ -1,5 +1,6 @@
---
title: {@html ...}
tags: template-html
---
To inject raw HTML into your component, use the `{@html ...}` tag:

@ -1,5 +1,6 @@
---
title: {@attach ...}
tags: attachments
---
Attachments are functions that run in an [effect]($effect) when an element is mounted to the DOM or when [state]($state) read inside the function updates.

@ -1,5 +1,6 @@
---
title: transition:
tags: transitions
---
A _transition_ is triggered by an element entering or leaving the DOM as a result of a state change.

@ -1,5 +1,6 @@
---
title: in: and out:
tags: transitions
---
The `in:` and `out:` directives are identical to [`transition:`](transition), except that the resulting transitions are not bidirectional — an `in` transition will continue to 'play' alongside the `out` transition, rather than reversing, if the block is outroed while the transition is in progress. If an out transition is aborted, transitions will restart from scratch.
@ -7,7 +8,7 @@ The `in:` and `out:` directives are identical to [`transition:`](transition), ex
```svelte
<script>
import { fade, fly } from 'svelte/transition';
let visible = $state(false);
</script>

@ -1,5 +1,6 @@
---
title: style:
tags: template-style
---
The `style:` directive provides a shorthand for setting multiple styles on an element.

@ -1,5 +1,6 @@
---
title: class
tags: template-style
---
There are two ways to set classes on elements: the `class` attribute, and the `class:` directive.

@ -1,5 +1,6 @@
---
title: Scoped styles
tags: styles-scoped
---
Svelte components can include a `<style>` element containing CSS that belongs to the component. This CSS is _scoped_ by default, meaning that styles will not apply to any elements on the page outside the component in question.

@ -1,5 +1,6 @@
---
title: Global styles
tags: styles-global
---
## :global(...)

@ -1,5 +1,6 @@
---
title: Custom properties
tags: styles-custom-properties
---
You can pass CSS custom properties — both static and dynamic — to components:

@ -1,5 +1,6 @@
---
title: svelte/attachments
tags: attachments
---
> MODULE: svelte/attachments

@ -1,5 +1,6 @@
---
title: svelte/transition
tags: transitions
---
> MODULE: svelte/transition

Loading…
Cancel
Save