Skip to content

Add support for using components as icons #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2022

Conversation

jamesWalker55
Copy link
Contributor

This allows using any arbitrary icon as the argument to 'icon', as long as the icon is a component.

Related issue: #12

Example usage with antfu/unplugin-icons:

<script lang="ts" setup>
import VueFileToolbarMenu from 'vue-file-toolbar-menu';
import Icon from '~icons/ph/tag';

import {computed} from 'vue';

const my_menu = computed(() => [
      {
        text: 'My Menu', menu: [
          {text: 'Item 1', click: () => alert('Action 1')},
          {text: 'Item 2', icon: 'sentiment_very_satisfied'},
          {text: 'Item 3', icon: Icon},
        ],
      },
      {
        icon: Icon,
        click: () => alert("Icon button!"),
      },
    ],
);
</script>

<template>
  <VueFileToolbarMenu :content="my_menu"/>
</template>

@motla motla merged commit 0855ea2 into motla:master Nov 20, 2022
@motla
Copy link
Owner

motla commented Nov 20, 2022

Hi @jamesWalker55
Thank you very much for your contribution!! 🙂
I just released v1.5.0 (Vue2) and v2.2.0 (Vue3) including your commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants