Vue
Render dynamic or fixed optical drawings in Vue.
On this page
#Dynamic icons
Vue is a required peer dependency. Install Vue 3.5 or a later 3.x release in your application and install @master/icons-vue.
<script setup lang="ts">import { SearchIcon } from '@master/icons-vue';</script><template> <SearchIcon :size="20" corner="rounded" label="Search" /></template>The dynamic entry includes all nine optical size and corner combinations, along with their supported stroke widths, for each imported icon. It shares the same geometry as the other frameworks and SVG. size selects the nearest optical drawing; corner defaults to soft.
#Fixed icons
<script setup lang="ts">import { SearchIcon } from '@master/icons-vue/16/soft';</script><template> <button aria-label="Search"><SearchIcon /></button></template>Fixed entries include only one optical size and corner style. Replace 16/soft with any combination of 16, 20, 24 and sharp, soft, rounded. Fixed components do not accept corner or opticalSize; size only scales the selected drawing.
#Framework behavior
Use optical-size in templates, such as :optical-size="16". SVG attributes and event listeners are forwarded to the SVG root. These are functional components; a component ref is not an SVG element ref.
Unlabeled icons are decorative. Use label, aria-label or aria-labelledby for a meaningful icon, or label the enclosing button. See accessibility.
#Custom stroke width
Both entries accept strokeWidth, in native units and steps of 0.25. It selects redrawn geometry rather than changing the SVG stroke attribute.
<script setup lang="ts">import { SearchIcon } from '@master/icons-vue/24/soft';</script><template> <SearchIcon :size="48" :stroke-width="2" /></template>See stroke width for the range of each optical size and how widths are drawn.