Getting Started - Svelte Ionicons v2

Requirements #

- Svelte 5 or later

Installation #

npx sv create myapp
cd myapp
pnpm i -D svelte-ionicons

Basic Usage #

In a svelte file:

<script>
  import { Accessibility } from 'svelte-ionicons';
</script>

<Accessibility />

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 Accessibility from 'svelte-ionicons/Accessibility.svelte';
</script>

<Accessibility />

Asscessible SVGs #

A11y props, title, desc, and ariaLabel are used for accessible SVG icons.

Passing down other attributes #

All icons have "...restProps" and you can pass other attibutes as well.

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

Import all #

Use import * as Icon from 'svelte-ionicons'.

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

<Icon.Accessibility />

<h1>Size</h1>
<Icon.Accessibility size="30" />