TDesign Icons for Vue 3

0.4.4 · active · verified Sun Apr 19

tdesign-icons-vue-next is an icon library specifically designed for Vue 3 applications, providing a comprehensive set of icons consistent with the TDesign design system. Its current stable version is 0.4.4. The library offers multiple integration strategies, allowing developers to choose between SVG sprite-based icons (`Icon`), IconFont-based icons (`IconFont`), or importing individual icon components (e.g., `CloseIcon`) for optimized bundle sizes. This flexibility is a key differentiator, catering to various project needs and performance considerations. While a specific release cadence isn't published, icon libraries typically follow a slower, feature-driven update cycle, ensuring stability for long-term projects. It serves as an essential companion for developers building applications with the TDesign UI framework in Vue 3 environments.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the three primary ways to use TDesign icons in a Vue 3 component: using the generic Icon component for SVG sprites, the IconFont component, and importing individual icon components.

import { defineComponent } from 'vue';
import { Icon, IconFont, CloseIcon, TimeIcon } from 'tdesign-icons-vue-next';

export default defineComponent({
  components: {
    Icon,
    IconFont,
    CloseIcon,
    TimeIcon
  },
  setup() {
    return {};
  },
  template: `
    <div>
      <h2>SVG Sprite Icons</h2>
      <Icon name="close" size="medium" />
      <Icon name="time" size="medium" />
      <p>Using the generic Icon component with a 'name' prop for SVG sprites.</p>

      <h2>IconFont Icons</h2>
      <IconFont name="star" size="medium" />
      <IconFont name="add" size="medium" />
      <p>Using the IconFont component with a 'name' prop.</p>

      <h2>Individual Icon Components</h2>
      <CloseIcon size="medium" />
      <TimeIcon size="medium" />
      <p>Directly importing and rendering specific icon components for better tree-shaking.</p>
    </div>
  `
});

view raw JSON →