There is a way to search for css pseudo elements:
FontAwesomeConfig = { searchPseudoElements: true };
This method is not recommended, as it will check existing markup and use CSS styles to add inline SVG for pseudo-elements, which is slow.
I do not recommend this method, so I will not explain how it works, if you are interested, you can learn more about it here .
Instead of using pseudo-elements, create a component for these checkboxes.
We will create a single file component called awesome-checkbox .
AwesomeCheckbox.vue
<template> <div :class="{'awesome-checkbox': true, [wrapperClassName]: !!wrapperClassName}" :style="{ color: isChecked ? checkedColor : uncheckedColor }"> <input :id="id" :name="name" type="checkbox" class="awesome-checkbox__input" v-model="checkboxModel"> <label :for="id" :style="{ cursor }" class="awesome-checkbox__label" @click="toggleCheck"> <font-awesome-icon :icon="isChecked ? checkedIcon : uncheckedIcon" :size="size" /> </label> </div> </template> <script> import FontAwesomeIcon from '@fortawesome/vue-fontawesome'; import { faSquare, faCheckSquare } from '@fortawesome/fontawesome-free-solid'; export default { name: 'awesome-checkbox', components: { FontAwesomeIcon }, props: { wrapperClassName: { type: String, default: null, }, name: { type: String, default: null, }, id: { type: String, default: null, required: true, }, model: { type: Boolean, default: null, required: true, }, cursor: { type: String, default: 'pointer', }, uncheckedIcon: { type: Object, default: () => faSquare, }, checkedIcon: { type: Object, default: () => faCheckSquare, }, size: { type: String, default: '1x', }, uncheckedColor: { type: String, default: 'inherit', }, checkedColor: { type: String, default: 'inherit', }, }, data() { return { isChecked: !!this.model, checkboxModel: this.model, }; }, methods: { emitModelValueUpdate() { this.$emit('update:model', this.isChecked); }, toggleCheck() { this.isChecked = !this.isChecked; this.emitModelValueUpdate(); }, }, }; </script> <style lang="scss" scoped> .awesome-checkbox { display: inline-flex; &__label { font-size: 1em; // Change Font-Awesome-Icon 5 icon size with css instead of predefined Font-Awesome-Icon 5 size prop. } &__input { display: none; // Hide the HTML <input> element. } } </style>
And use it in the parent component, for example:
<template> <div> <awesome-checkbox :model.sync="acceptTerms" checkedColor="#41B883" uncheckedColor="#E0EAF1" cursor="pointer" size="1x" id="my-awesome-checkbox" name="acceptTerms" :checkedIcon="faCheckSquare" :uncheckedIcon="faSquare" /> </div> </template> <script> import { faSquare, faCheckSquare } from '@fortawesome/fontawesome-free-solid'; import AwesomeCheckbox from '@/components/path/to/AwesomeCheckbox'; export default { name: 'parent-component', components: { AwesomeCheckbox }, data() { return { acceptTerms: false, faSquare, faCheckSquare, }; }, }; </script> <style lang="scss" scoped> </style>
You can expand this component according to your needs, for example, make model prop more than one type, for example Array, and not a logical one.
I just made this component for your question and did not test it completely, please use it carefully.