Skip to content
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

Error event when icon cannot be resolved #385

Open
manniL opened this issue Aug 8, 2022 · 1 comment
Open

Error event when icon cannot be resolved #385

manniL opened this issue Aug 8, 2022 · 1 comment

Comments

@manniL
Copy link

manniL commented Aug 8, 2022

Is your feature request related to a problem? Please describe.
Hey! 👋
Right now it is difficult to handle edge cases when icons cannot be resolved (think of e.g. user input) and to show a default icon in this case.

Describe the solution you'd like
It would be helpful if the component could emit an error event that parent components can listen to and act accordingly instead of just logging the error.

Describe alternatives you've considered
Right now, only checking the DOM manually, which is tedious 😂

@chemtrails
Copy link

+1
AFAIK right now you have to check your input like

<template>
    <font-awesome-icon v-if="icons.includes(userInput)" :icon="['fab', userInput]"></font-awesome-icon>
</template>

<script setup>
    import { fab } from '@fortawesome/free-brands-svg-icons'
    const icons = Object.values(fab).map(v => v.iconName)
    const userInput = ref('twitter')
</script>

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

No branches or pull requests

3 participants