Skip to content

Svelte

Optimized image component for Svelte.

Install

sh
$ npm add @urami/svelte
$ npm add @urami/svelte
sh
$ pnpm add @urami/svelte
$ pnpm add @urami/svelte
sh
$ yarn add @urami/svelte
$ yarn add @urami/svelte
sh
$ bun add @urami/svelte
$ bun add @urami/svelte

Usage

svelte
<script>
  import Image from '@urami/svelte'
</script>

<Image
  src="https://demo.rayriffy.com/tom-scott.jpg"
  width={801}
  height={801}
  alt="Tom Scott"
  class="rounded-xl shadow-md"
/>
<script>
  import Image from '@urami/svelte'
</script>

<Image
  src="https://demo.rayriffy.com/tom-scott.jpg"
  width={801}
  height={801}
  alt="Tom Scott"
  class="rounded-xl shadow-md"
/>

Props

NameTypeDefaultRequiredDescription
srcstring-Source of the image
widthnumber-Width of the image
heightnumber-Height of the image (Specify this will results in less layout shift)
qualitynumber75Quality of the image
loaderfndefaultLoaderLoader function, please refer to Loader