CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-tabler--icons-vue

Implementation of the Tabler Icons library for Vue 3 applications with over 5,900 high-quality SVG icons.

Pending
Overview
Eval results
Files

icon-components.mddocs/

Icon Components

Individual Vue components for each Tabler icon, providing a comprehensive set of 5,945 icons available as tree-shakable Vue 3 components. Each icon comes in outline (default) and filled variants with consistent prop interfaces.

Capabilities

Icon Component Interface

All icon components share the same props interface and behavior patterns.

/**
 * Base interface for all icon components
 * Extends Vue's SVGAttributes but replaces 'stroke' prop for better Vue compatibility
 */
interface IconProps extends Partial<Omit<SVGAttributes, 'stroke'>> {
  /** Icon size in pixels (width and height) - Default: 24 */
  size?: string | number;
  /** Stroke color for outline icons or fill color for filled icons - Default: 'currentColor' */
  stroke?: string | number;
  /** Accessibility title element content */
  title?: string;
}

/**
 * Functional component type for all icon components
 */
type Icon = FunctionalComponent<IconProps>;

Outline Icons

Default icon style with configurable stroke properties. 4,964 outline icons available.

// Examples of outline icon components
declare const IconHome: Icon;
declare const IconSettings: Icon;
declare const IconUser: Icon;
declare const IconMail: Icon;
declare const IconPhone: Icon;
declare const IconCalendar: Icon;
declare const IconSearch: Icon;
declare const IconMenu: Icon;
declare const IconChevronDown: Icon;
declare const IconPlus: Icon;

Usage Examples:

<template>
  <!-- Basic outline icon -->
  <IconHome />
  
  <!-- Customized outline icon -->
  <IconHome 
    color="blue" 
    size="32" 
    stroke-width="1"
  />
  
  <!-- With accessibility title -->
  <IconSettings title="Open Settings" />
  
  <!-- With event handlers -->
  <IconSearch @click="performSearch" />
</template>

<script setup>
import { IconHome, IconSettings, IconSearch } from '@tabler/icons-vue';

function performSearch() {
  console.log('Search clicked');
}
</script>

Filled Icons

Solid icon style with fill color control. 981 filled icons available.

// Examples of filled icon components  
declare const IconHomeFilled: Icon;
declare const IconSettingsFilled: Icon;
declare const IconUserFilled: Icon;
declare const IconMailFilled: Icon;
declare const IconPhoneFilled: Icon;
declare const IconCalendarFilled: Icon;
declare const IconSearchFilled: Icon;
declare const IconMenuFilled: Icon;
declare const IconChevronDownFilled: Icon;
declare const IconPlusFilled: Icon;

Usage Examples:

<template>
  <!-- Basic filled icon -->
  <IconHomeFilled />
  
  <!-- Customized filled icon -->
  <IconHomeFilled 
    color="red" 
    size="28"
  />
  
  <!-- Filled icons don't use stroke-width -->
  <IconSettingsFilled fill="green" />
</template>

<script setup>
import { IconHomeFilled, IconSettingsFilled } from '@tabler/icons-vue';
</script>

Icon Naming Patterns

Icons follow consistent naming conventions for predictable imports.

// Naming pattern examples
declare const IconHome: Icon;              // outline version
declare const IconHomeFilled: Icon;        // filled version

declare const IconArrowUp: Icon;           // outline version  
declare const IconArrowUpFilled: Icon;     // filled version

declare const IconBrandGithub: Icon;       // brand icons (outline only)
declare const IconNumber123: Icon;         // number icons
declare const IconLetterA: Icon;           // letter icons

// Multi-word icons use PascalCase
declare const IconAccessible: Icon;
declare const IconAccessibleFilled: Icon;
declare const IconShoppingCart: Icon;
declare const IconShoppingCartFilled: Icon;

Component Properties

All icon components support consistent properties and behaviors.

/**
 * Size property - controls both width and height
 * @param size - Number in pixels or string with units
 */
size?: string | number; // Default: 24

/**
 * Color property - stroke color for outline, fill color for filled
 * @param stroke - CSS color value
 */
stroke?: string | number; // Default: 'currentColor'

/**
 * Alternative color properties (Vue attribute compatibility)
 */
color?: string;      // Alternative to stroke
strokeWidth?: string | number; // Outline icons only

/**
 * Accessibility support
 * @param title - Screen reader title text
 */
title?: string;

/**
 * CSS class support
 */
class?: string | string[] | Record<string, boolean>;

/**
 * Style attribute support
 */
style?: string | Record<string, string>;

CSS Classes and Styling

All icon components automatically receive CSS classes for styling and theming.

// Automatic CSS classes applied to all icons
class="tabler-icon tabler-icon-{icon-name}"

// Examples:
// <IconHome /> gets: class="tabler-icon tabler-icon-home"
// <IconSettings /> gets: class="tabler-icon tabler-icon-settings"
// <IconShoppingCart /> gets: class="tabler-icon tabler-icon-shopping-cart"

CSS Styling Examples:

/* Style all tabler icons */
.tabler-icon {
  transition: color 0.2s ease;
}

/* Style specific icon */
.tabler-icon-home {
  color: blue;
}

/* Hover effects */
.tabler-icon:hover {
  color: var(--primary-color);
}

Event Handling

Icon components support all Vue event handlers like regular components.

Usage Examples:

<template>
  <!-- Click events -->
  <IconHome @click="goHome" />
  
  <!-- Mouse events -->
  <IconSettings 
    @mouseenter="showTooltip"
    @mouseleave="hideTooltip"
  />
  
  <!-- Keyboard events -->
  <IconSearch 
    tabindex="0"
    @keydown.enter="performSearch"
  />
</template>

<script setup>
import { IconHome, IconSettings, IconSearch } from '@tabler/icons-vue';

function goHome() {
  console.log('Home clicked');
}

function showTooltip() {
  console.log('Show tooltip');
}

function hideTooltip() {
  console.log('Hide tooltip');
}

function performSearch() {
  console.log('Search triggered');
}
</script>

Slot Support

Icon components support default slots for adding custom SVG content.

Usage Examples:

<template>
  <!-- Add custom SVG elements to an icon -->
  <IconHome>
    <circle cx="12" cy="12" r="2" fill="red" />
  </IconHome>
  
  <!-- Add text elements -->
  <IconSettings>
    <text x="12" y="16" text-anchor="middle" font-size="6">!</text>
  </IconSettings>
</template>

<script setup>
import { IconHome, IconSettings } from '@tabler/icons-vue';
</script>

Icon Aliases

Alternative names for icons to maintain backward compatibility and provide intuitive naming options.

// Example aliases (100+ available)
declare const IconCodeAsterix: Icon;        // Alias for IconCodeAsterisk
declare const IconDiscount2: Icon;          // Alias for IconRosetteDiscount  
declare const Icon2fa: Icon;                // Alias for IconAuth2fa
declare const Icon3dCubeSphere: Icon;       // Alias for IconCube3dSphere
declare const IconCircle0: Icon;            // Alias for IconCircleNumber0
declare const IconSquare1: Icon;            // Alias for IconSquareNumber1

Usage Examples:

<template>
  <!-- Using aliases - same as regular icons -->
  <IconCodeAsterix />
  <Icon2fa />
  <IconCircle0 />
</template>

<script setup>
import { IconCodeAsterix, Icon2fa, IconCircle0 } from '@tabler/icons-vue';
</script>

Install with Tessl CLI

npx tessl i tessl/npm-tabler--icons-vue

docs

component-factory.md

icon-components.md

index.md

typescript-support.md

tile.json