Getting Started - Svelte Ant Design Icons v2

GitHub Sponsor - shinokada NPM version of svelte-ant-design-icons github License NPM dw Downloads - svelte-ant-design-icons

Requirements #

- Svelte 5 or later

Installation #

Install Svelte and svelte-ant-design-icons v2:

npx sv create myapp
cd myapp
pnpm i -D svelte-ant-design-icons

Basic Usage #

In a svelte file:

<script>
  import { AppstoreAddOutlined } from 'svelte-ant-design-icons';
</script>

<AppstoreAddOutlined />

A11y friendly #

Use title, desc, and ariaLabel props to make your icons accessible.

<AddressBookOutline
  title={{ id: 'my-title', title: 'Red bell' }}
  desc={{ id: 'my-descrip', desc: 'The shape of a red bell' }}
  ariaLabel="red bell"
  color="red"
/>

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 AppstoreAddOutlined from 'svelte-ant-design-icons/AppstoreAddOutlined.svelte';
</script>

<AppstoreAddOutlined />

Passing down other attributes #

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

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

Import all #

Use import * as Icon from 'svelte-ant-design-icons.

<script>
  import * as Icon from 'svelte-ant-design-icons';
</script>

<Icon.AppstoreAddOutlined />

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