Getting Started - Svelte Tabler v1

npm

Requirements #

You need to use the following:

- Svelte 4 or 5 (without Runes)

Installation #

Install Svelte and TailwindCSS:

npm create svelte@latest my-project
cd my-project
pnpm i -D svelte-tabler

Basic Usage #

In a svelte file:

<script>
  import { Accessible } from 'svelte-tabler';
</script>

<Accessible />

aria-label #

Use ariaLabel props to edit the aria-label.

<Accessible
  ariaLabel="blue accessibility icon"
  color="blue"
/>

IDE support #

If you are using an LSP-compatible editor, such as VSCode, Atom, Sublime Text, or Neovim, hovering over a component name will display a documentation link, features, props, events, etc.

Faster compiling #

If you need only a few icons from this library in your Svelte app, import them directly. This can optimize compilation speed and improve performance by reducing the amount of code processed during compilation.

<script>
  import Accessible from 'svelte-tabler/Accessible.svelte';
</script>

<Accessible />

Passing down other attributes #

Since all icons have ...$$restProps, you can pass other attibutes as well.

<Accessible id="my-svg" transform="rotate(45)" />

Using svelte:component #

<script>
  import { Accessible } from 'svelte-tabler';
</script>

<svelte:component this="{Accessible}" />

Using onMount #

<script>
  import { Accessible } from 'svelte-tabler';
  import { onMount } from 'svelte';
  const props = {
    size: '50',
    color: '#ff0000'
  };
  onMount(() => {
    const icon = new Accessible({ target: document.body, props });
  });
</script>

Import all #

Use `import * as Icon from 'svelte-tabler`.

<script>
  import * as Icon from 'svelte-tabler';
</script>

<Icon.Accessible />
<Icon.Accessible size="30" />