Getting Started - Flowbite Svelte Icons v2

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

Requirements #

- Svelte 5 or later
- TailwindCSS

Installation #

npx sv create myapp
// select tailwindcss to install
cd myapp
pnpm i -D flowbite-svelte-icons

To make sure the classes used by flowbite-svelte-icons are included by the Tailwindcss, add the following to tailwind.config.cjs.

const config = {
  content: [
       // more lines
        "./node_modules/flowbite-svelte-icons/**/*.{html,js,svelte,ts}",
    ],
    // more lines
}  

Basic Usages #

In a svelte file:

<script>
  import { AddressBookOutline } from 'flowbite-svelte-icons';
</script>

<AddressBookOutline />

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 AddressBookOutline from 'flowbite-svelte-icons/AddressBookOutline.svelte';
</script>

<AddressBookOutline />

Passing down other attributes #

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

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

Import all #

Use import * as Icon from 'flowbite-svelte-icons.

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

<Icon.AddressBookOutline />

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

<h1>Tailwind CSS</h1>
<Icon.AddressBookOutline class="text-blue-500" />

IconSolid and IconOutline #

You can use IconSolid and IconOutline to create a custom icon.