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

Add material symbols support ? #96

Open
LoganTann opened this issue Jul 16, 2022 · 1 comment
Open

Add material symbols support ? #96

LoganTann opened this issue Jul 16, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@LoganTann
Copy link

It would be really cool to provide a way to import google's icons using the following configuration :

googleFonts: {
  // ref : https://fonts.google.com/icons
  icons: {
    filled: true,
    weight: 500,
    grade: 0,
    size: 20
  }
}

and then using the following code :

<p>
  Description icon : 
  <span class="material-symbols-outlined">description </span>
</p>

or even

<p>
  Description icon : 
  <material-icon>description</material-icon>
</p>
@ryansegus
Copy link

Sounds nice but this will download the variable or static icon?

In a nuxt 3 project I am using this configuration and it seems to work pretty well:

families: {
     ... /* main fonts */
     'Material Symbols Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200': true,
   },

Then on my CSS I have:


.material-symbols-outlined {

    &.-empty { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48; }
 
    &.-filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48; }
 
    &.-slim { font-variation-settings: 'FILL' 0, 'wght' 100, 'GRAD' 0, 'opsz' 48;  }
 }
 

Which allows me to use a reusable component with variants:

<script lang="ts" setup>
interface Props {
  icon: string
  variant?: '-empty' | '-filled' | '-slim'
}

const props = withDefaults(defineProps<Props>(), {
  variant: '-empty',
})
</script>

<template>
<span :class="['material-symbols-outlined', variant]">{{ icon }}</span>
</template>
  

So, it'll be nice to have this option to be able to get the variable font as well:


googleFonts: {
  // ref : https://fonts.google.com/icons
  icons: {
    filled: '0..1', // Maybe allowing number | string ?
    weight: '100..700',
    grade: '-50..200',
    size: '20...48'
  }
}

@ricardogobbosouza ricardogobbosouza added the enhancement New feature or request label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants