tabler-icons/packages/icons-svelte-runes
Paweł Kuna 2702274bfa
Update package dependencies and configurations (#1447)
* Update package dependencies and configurations

* Update GitHub Actions workflow to use Node.js 22 and adjust build command to utilize pnpm for improved consistency and performance.

* Remove specific pnpm version from GitHub Actions workflow to allow for more flexible dependency management.

* Remove specific pnpm version from GitHub Actions workflow for improved flexibility in dependency management.

* Add rsvg-convert availability check in convertIconsToImages function to prevent errors when the command is not found

* Update GitHub Actions workflow to use Node.js 22 for improved compatibility and performance.

* Remove push trigger from GitHub Actions workflow to streamline build process and focus on pull requests.

* Add system dependencies for canvas in GitHub Actions workflow and update package.json to include canvas dependency

* Update GitHub Actions workflow to install additional system dependencies for canvas and rsvg-convert

* Update pnpm-lock.yaml to add canvas dependency and remove optional flags from several packages

* Update package.json to upgrade pnpm from version 10.12.1 to 10.26.1 for improved performance and compatibility.

* Refactor Eleventy configuration to use Sass directly and update package dependencies for improved compatibility and performance. Added support for SCSS file compilation and updated various package versions in package.json and pnpm-lock.yaml.

* Reorganize GitHub Actions workflow to reposition the in-progress comment step for better clarity and execution flow during icon validation.

* Update GitHub Actions workflows to install pnpm version 10.26.2 for consistency across build and validation processes.

* Install additional system dependencies for canvas and rsvg-convert in GitHub Actions workflow to ensure proper build environment.

* Ensure canvas is loaded before jsdom by using require in utilities.mjs

* Update canvas and @napi-rs/canvas dependencies to version 3.2.0 and 0.1.88 respectively in package.json and pnpm-lock.yaml for improved compatibility. Add "onlyBuiltDependencies" field in package.json to specify required dependencies.
2025-12-30 18:33:11 +01:00
..
src Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
.gitignore Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
README.md Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
build.mjs Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
package.json Update package dependencies and configurations (#1447) 2025-12-30 18:33:11 +01:00
setupVitest.ts Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
svelte.config.js Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
test.spec.js Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
tsconfig.json Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
vitest-setup.d.ts Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00
vitest.config.ts Add Svelte 5 (Runes) icon package (#1434) 2025-12-14 13:03:48 +01:00

README.md

Tabler Icons for Svelte (Runes)

Tabler Icons

Implementation of the Tabler Icons library for Svelte 5+ using the new runes reactivity system.

Browse all icons at tabler-icons.io →

Latest Release License

Why This Package?

This package is specifically built for Svelte 5+ using the new runes reactivity system ($props(), $derived, etc.).

  • For Svelte 5+ projects: Use this package (@tabler/icons-svelte-runes)
  • For Svelte 3/4 projects: Use @tabler/icons-svelte

Installation

pnpm add @tabler/icons-svelte-runes

or

npm install @tabler/icons-svelte-runes

or

yarn add @tabler/icons-svelte-runes

Requirements

  • Svelte 5.0+ with runes enabled
  • For older Svelte versions, use @tabler/icons-svelte instead

Usage

It's built with ES modules so it's completely tree-shakable. Each icon can be imported as a component.

<script lang="ts">
import { IconHeart } from '@tabler/icons-svelte-runes';
</script>

<IconHeart />

You can pass additional props to adjust the icon:

<IconHeart size={48} stroke={1} color="red" />

Props

name type default
size number | string 24
color string currentColor
stroke number | string 2
class string ''

All other HTML attributes are forwarded to the SVG element.

TypeScript Support

The package includes full TypeScript definitions. Icons are typed as Svelte 5 Component<IconProps>:

import type { Icon } from '@tabler/icons-svelte-runes';
import { IconHeart } from '@tabler/icons-svelte-runes';

// Icon is compatible with Svelte 5's Component type
const MyIcon: Icon = IconHeart;

Using Icons in Props

When passing icons as props, use the Component type or any for maximum compatibility:

<script lang="ts">
import type { Component } from 'svelte';
import { IconHeart } from '@tabler/icons-svelte-runes';

interface Props {
  icon: Component<any>;
  label: string;
}

let { icon: Icon, label }: Props = $props();
</script>

<button>
  <Icon size={20} />
  {label}
</button>

Examples

Basic Icon Usage

<script lang="ts">
import { IconHeart, IconStar, IconHome } from '@tabler/icons-svelte-runes';
</script>

<IconHeart />
<IconStar size={32} color="gold" />
<IconHome stroke={1.5} class="my-icon" />

Dynamic Icons with Runes

<script lang="ts">
import { IconHeart, IconStar, IconCircle } from '@tabler/icons-svelte-runes';

const icons = {
  heart: IconHeart,
  star: IconStar,
  circle: IconCircle
};

let selected = $state('heart');
let DynamicIcon = $derived(icons[selected]);
</script>

<DynamicIcon size={32} />

<button onclick={() => selected = 'heart'}>Heart</button>
<button onclick={() => selected = 'star'}>Star</button>
<button onclick={() => selected = 'circle'}>Circle</button>

Reactive Size with $derived

<script lang="ts">
import { IconHeart } from '@tabler/icons-svelte-runes';

let isLarge = $state(false);
let iconSize = $derived(isLarge ? 48 : 24);
</script>

<IconHeart size={iconSize} />
<button onclick={() => isLarge = !isLarge}>Toggle Size</button>

Migrating from @tabler/icons-svelte

The API is identical, just change the package name:

- import { IconHeart } from '@tabler/icons-svelte';
+ import { IconHeart } from '@tabler/icons-svelte-runes';

No other changes needed! Your existing props and usage remain the same.

What's Different from @tabler/icons-svelte?

Internally, this package uses Svelte 5's new features:

  • $props() instead of export let
  • $derived for computed values
  • Modern TypeScript Component type
  • Optimized for Svelte 5's fine-grained reactivity

Result: Better performance and smaller bundle sizes in Svelte 5 projects!

Sponsors

If you want to support this project, you can become a sponsor on GitHub or just donate on PayPal :)

Tabler sponsors

Contributing

For more info on how to contribute please see the contribution guidelines.

Caught a mistake or want to contribute to the documentation? Edit this page on Github

License

Tabler Icons is licensed under the MIT License.

Sponsor Tabler

Sponsor Tabler