Vueless Docs
ComponentsGitHubWebsite
  • Installation
    • Quick start (Vue)
    • Quick start (Nuxt)
    • Class autocompletion
    • Minimal requirements
    • Storybook docs
  • Global customization
    • General
    • Colors
    • Rounding
    • Focus Outline
    • Dark mode
    • Base Classes
    • Custom tailwind classes
  • Component customization
    • General
    • Styling
    • Conditional styling
    • Extends styling from keys
    • Nested components styling
    • Classes smart merging
    • Props defaults
    • Redefining props
    • Defining custom props
    • Internationalization (i18n)
  • Creating own components
    • Vueless file structure
    • Create new component
    • Copy existing component
  • Svg Icons
    • General usage
    • Custom icons
    • Dynamic import
    • Advanced settings
  • Helpers
    • Change settings in runtime
Powered by GitBook
On this page
  1. Svg Icons

Custom icons

The <UIcon> component also supports custom SVG icons. To use a custom icon, import it with the suffix ?component and pass the imported component in the :src prop.

<script setup>
import EqualIcon from "./images/equal.svg?component";
</script>

<UIcon :src="EqualIcon" />

Custom library

To reference all icons from your project, specify your library path in the config.

vueless.config.js
export default {
  component: {
    UIcon: {
      defaults: {
        library: "custom-icons", /* tells Vueless that the library is custom */
        path: "src/assets/icons", /* path to the icons folder from the project root */
      }
    }
  }
};

In this case, the library name should be custom-icons, which is a predefined name.

Afterward, you can use the icons by passing the prop name in the <UIcon> component.

<UIcon :name="equal-icon" />

Last updated 4 months ago