Svelte and SvelteKit 5 · Template syntax

Show an async result

Render pending, success and error states of a promise.

{#await promise}
  <p>Loading...</p>
{:then data}
  <p>{data.title}</p>
{:catch error}
  <p>Failed: {error.message}</p>
{/await}

Official Svelte and SvelteKit 5 documentation

More template syntax commands

All template syntax commands · Svelte and SvelteKit 5 cheatsheet

Was this page helpful?