Giter VIP home page Giter VIP logo

Comments (6)

silverbackdan avatar silverbackdan commented on May 19, 2024 14

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.

silverbackdan avatar silverbackdan commented on May 19, 2024 2

Also, you could add the sizing to font-awesome-layers

<font-awesome-layers class="fa-2x">

Or each individual icon

from vue-fontawesome.

robmadole avatar robmadole commented on May 19, 2024

Thanks for the docs @silverbackdan

from vue-fontawesome.

Pinnokkio avatar Pinnokkio commented on May 19, 2024

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:
image
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.

BorisKamp avatar BorisKamp commented on May 19, 2024

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.

Pinnokkio avatar Pinnokkio commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.