0.1.1 • Published 1 year ago

vue3-icon-picker v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Vue 3 Icon Picker npm (scoped)

Icon picker component

Installation

If you are using npm:

npm i vue3-icon-picker

If you are using yarn:

yarn add vue3-icon-picker

About

This package use icons from xicons with SVG components integrated from fluentui-system-icons, ionicons, ant-design-icons, material-design-icons, Font-Awesome, tabler-icons and carbon. Check this website for view icons list: https://www.xicons.org.

Demo

View the live demo here

Usage

You can add this package globally to your project:

// main.js
import { createApp } from 'vue'

import App from './App.vue'

import Vue3IconPicker from 'vue3-icon-picker'
import 'vue3-icon-picker/dist/style.css'

createApp(App).use(Vue3IconPicker).mount('#app')

If needed rename component to use:

createApp(App).use(Vue3IconPicker, { name: 'IconPicker' }).mount('#app') // use in template <IconPicker />

Alternatively you can also import the component locally:

<script setup>
 import { Vue3IconPicker } from 'vue3-icon-picker'
 import 'vue3-icon-picker/dist/style.css'
</script>

You can then use the component in your template

<template>
 <Vue3IconPicker v-model="icon" placeholder="Select icon" />
</template>

Props

NameTypeDescriptionDefaultRequired
v-modelstring / string[]Selection, icon(s) SVG code(s) or name(s)nullYes
placeholderstringInput placeholderundefinedNo
multiplebooleanEnable multiple selection when set to truefalseNo
multipleLimitnumberMaximum number of selections when multiple selection is enabledInfinityNo
selectedItemsToDisplaynumberNumber of selected icons to display when multiple selection is enabled9No
iconLibrary'all' / 'antd' / 'carbon' / 'fa' / 'fluent' / 'ionicons4' / 'ionicons5' / 'material' / 'tabler'Icon library to display. This property can take an array of several libraries to display'fa'No
selectedIconBgColorstringSelected icon(s) background color'#d3d3d3'No
selectedIconColorstringSelected icon(s) color'#000000'No
clearablebooleanMake selected icon clearable when multiple is falsefalseNo
disabledbooleanDisable componentfalseNo
displaySearchbooleanDisplay search inputtrueNo
searchPlaceholderstringSearch input placeholder'Search'No
valueType'svg' / 'name'Type of selection value, icon(s) SVG code(s) or name(s)'svg'No
includeIconsstring[]List of icons to include[]No
excludeIconsstring[]List of icons to exclude[]No
includeSearchstringThe search query whose results must be includedundefinedNo
excludeSearchstringThe search query whose results must be excludedundefinedNo
emptyTextstringEmpty text'Nothing to show'No

Slots

NameParametersDescription
empty()Empty slot for the dropdown icons list

Events

  • change
    • This event is fired when selection change.

Display icons

You can simply display icons like that if your value type is svg:

<script setup>
 const icon = ref(null)
</script>

<template>
 <Vue3IconPicker v-model="icon" placeholder="Select icon" />
 <i v-html="icon"></i>
</template>

Or use custom icon component provided by this package:

<script setup>
 import { Icon } from 'vue3-icon-picker'
 const icon = ref(null)
</script>

<template>
 <Vue3IconPicker v-model="icon" placeholder="Select icon" />
 <Icon :data="icon" :size="24" color="#124ebb"></Icon>
</template>

Icon Props

NameTypeDescriptionDefaultRequired
datastringIcon svg code or nameundefinedYes
sizenumber / stringIcon size24No
colorstringIcon colorundefinedNo

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Changelog

Detailed changes for each release are documented in the release notes.

License

MIT

0.1.1

1 year ago

0.1.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago