Comments (6)
Having a dive into the source files you can import the layers gubbins like this
import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome'
...
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.component('font-awesome-layers', FontAwesomeLayers)
In your component
<font-awesome-layers>
<font-awesome-icon icon="circle" />
<font-awesome-icon icon="check" style="color: white;" transform="shrink-6" />
</font-awesome-layers>
It'd be nice to be added to the readme, I'll quickly create a PR
from vue-fontawesome.
Also, you could add the sizing to font-awesome-layers
<font-awesome-layers class="fa-2x">
Or each individual icon
from vue-fontawesome.
Thanks for the docs @silverbackdan
from vue-fontawesome.
Whenever I use
<fa-layers class="fa-4x">
<fa :icon="['fas', 'camera']" style="color: white;"/>
<fa :icon="['fas', 'ban']" style="color: red;" transform="shrink-6" class="fa-2x"/>
</fa-layers>
it'll look like this:
It's not centered on top of each other and it doesn't look the same as described in the docs (like camera is fully visible in the docs but in my case it's still too large): https://fontawesome.com/docs/web/style/stack
Any ideas how to fix this?
from vue-fontawesome.
Whenever I use
<fa-layers class="fa-4x"> <fa :icon="['fas', 'camera']" style="color: white;"/> <fa :icon="['fas', 'ban']" style="color: red;" transform="shrink-6" class="fa-2x"/> </fa-layers>
It's not centered on top of each other and it doesn't look the same as described in the docs (like camera is fully visible in the docs but in my case it's still too large): https://fontawesome.com/docs/web/style/stack Any ideas how to fix this?
I had this when I was using vue3/nuxt3. I had to import FontAwesomeLayers
in the /plugins/fontawesome.ts
file and create the component like so:
// For Nuxt 3
import { config, library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { fab } from '@fortawesome/free-brands-svg-icons'
// This is important, we are going to let Nuxt worry about the CSS
config.autoAddCss = false
// You can add your icons directly in this plugin. See other examples for how you
// can add other styles or just individual icons.
library.add(fas, fab)
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('font-awesome-icon', FontAwesomeIcon)
nuxtApp.vueApp.component('font-awesome-layers', FontAwesomeLayers)
})
only then my stacked icons started working....
from vue-fontawesome.
Whenever I use
<fa-layers class="fa-4x"> <fa :icon="['fas', 'camera']" style="color: white;"/> <fa :icon="['fas', 'ban']" style="color: red;" transform="shrink-6" class="fa-2x"/> </fa-layers>
It's not centered on top of each other and it doesn't look the same as described in the docs (like camera is fully visible in the docs but in my case it's still too large): https://fontawesome.com/docs/web/style/stack Any ideas how to fix this?
I had this when I was using vue3/nuxt3. I had to import
FontAwesomeLayers
in the/plugins/fontawesome.ts
file and create the component like so:// For Nuxt 3 import { config, library } from '@fortawesome/fontawesome-svg-core' import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome' import { fas } from '@fortawesome/free-solid-svg-icons' import { fab } from '@fortawesome/free-brands-svg-icons' // This is important, we are going to let Nuxt worry about the CSS config.autoAddCss = false // You can add your icons directly in this plugin. See other examples for how you // can add other styles or just individual icons. library.add(fas, fab) export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.component('font-awesome-icon', FontAwesomeIcon) nuxtApp.vueApp.component('font-awesome-layers', FontAwesomeLayers) })only then my stacked icons started working....
This is my code:
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome';
import { far } from '@fortawesome/free-regular-svg-icons';
import { fas } from '@fortawesome/free-solid-svg-icons';
library.add(far, fas);
export default function(app) {
app.component('fa', FontAwesomeIcon);
app.component('fa-layers', FontAwesomeLayers);
}
But whenever I add config.autoAddCss = false
, all icons are way too big and some icons are missing. It breaks everything.
from vue-fontawesome.
Related Issues (20)
- Typescript error in Nuxt 3 integration HOT 6
- Incorrect type definition causing issues with Volar HOT 3
- Icons not working in Vue3 while rendering with v-html HOT 1
- 3.x Types Issue: FontAwesomeIconProps missing values HOT 2
- eslint: FontAwesomeIcon not found in '@fortawesome/vue-fontawesome' HOT 6
- Vue-FA 3 with Vue 3 global HOT 2
- 2.0.9 multiple versions leading to checksum errors HOT 4
- Update latest npm tag to v3 HOT 4
- 3.x Types Issue: FontAwesomeIconProps missing values HOT 3
- Nuxt 3 - Content duplicated by using font-awesome-icon HOT 16
- ESLint cannot recognize FontAwesomeIcon import HOT 3
- Computed property "title" is already defined in Props. HOT 1
- Unexpected Token - fresh @fortawesome install HOT 2
- Spin does not work on the Edge browser on Android phones, but it works on the Edge browser on Windows 11
- npm run build failed with [email protected] HOT 2
- How to use plugin alongside with kits HOT 1
- make an icon component specifically for tree shaking HOT 8
- Inertia.js, Laravel, Vue 3, SSR: Could not find one or more icon(s) HOT 2
- Make FontAwesomeIconProps exportable HOT 9
- Unique ID generated when using a "title" breaks SSR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-fontawesome.