-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[Feature Request] Support for Material Symbols #20053
Comments
i need this |
Initially it looked like a good idea, until I actually integrated them and noticed that
You can actually use them today as aliases from "MD" set seem to work just fine. import '@material-symbols/font-400/outlined.css'
import { aliases } from 'vuetify/iconsets/md' // aliases are the same
import { VLigatureIcon } from 'vuetify/lib/composables/icons.mjs'
import { h } from 'vue'
const mat = { component: (props: any) => h(VLigatureIcon, { ...props, class: 'material-symbols-outlined' }) }
import { createVuetify } from 'vuetify'
const vuetify = createVuetify({
icons: {
defaultSet: 'mat',
aliases,
sets: { mat },
},
}) <v-container class="d-flex flex-wrap ga-3" width="600">
<v-btn variant='outlined' v-for='ic in Object.values(aliases)' :key='ic' :icon='ic' />
</v-container> Apart from incorrect symbols for But it does not feel like the font is ready for official Vuetify support. I can only recommend using it through |
I was able to achieve this by creating an iconset and modify the render to accept a variant prop where i can specify: "regular", "rounded", "sharp", "outline", "outline-rounded, "outline-sharp" default to "outline" then render the icon based on classes.
USAGE
here is the code if anyone need this: import { h } from 'vue'
import type { IconSet, IconAliases, IconProps } from 'vuetify'
const aliases: IconAliases = {
collapse: 'keyboard_arrow_up',
complete: 'check',
cancel: 'cancel',
close: 'close',
delete: 'cancel',
// delete (e.g. v-chip close)
clear: 'cancel',
success: 'check_circle',
info: 'info',
warning: 'priority_high',
error: 'warning',
prev: 'chevron_left',
next: 'chevron_right',
checkboxOn: 'check_box',
checkboxOff: 'check_box_outline_blank',
checkboxIndeterminate: 'indeterminate_check_box',
delimiter: 'fiber_manual_record',
// for carousel
sortAsc: 'arrow_upward',
sortDesc: 'arrow_downward',
expand: 'keyboard_arrow_down',
menu: 'menu',
subgroup: 'arrow_drop_down',
dropdown: 'arrow_drop_down',
radioOn: 'radio_button_checked',
radioOff: 'radio_button_unchecked',
edit: 'edit',
ratingEmpty: 'star_border',
ratingFull: 'star',
ratingHalf: 'star_half',
loading: 'cached',
first: 'first_page',
last: 'last_page',
unfold: 'unfold_more',
file: 'attach_file',
plus: 'add',
minus: 'remove',
calendar: 'event',
treeviewCollapse: 'arrow_drop_down',
treeviewExpand: 'arrow_right',
eyeDropper: 'colorize'
}
interface ExtendedIconProps extends IconProps {
variant?: 'outlined' | 'sharp' | 'rounded'
}
const mds: IconSet = {
component: (props: ExtendedIconProps) => {
const iconClass = props.variant
? `material-symbols-${props.variant}`
: 'material-symbols-outlined'
return h(props.tag, {
...props,
class: iconClass,
innerHTML: props.icon
})
}
}
export { aliases, mds } This is the Vuetify configuration using the icon set import '@mdi/font/css/materialdesignicons.css'
import 'material-symbols'
import 'vuetify/styles'
import { aliases, mds } from './iconsets/mds'
import { mdi } from 'vuetify/iconsets/mdi'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import * as labsComponents from 'vuetify/labs/components'
export default createVuetify({
components: {
...components,
...labsComponents,
},
directives,
icons: {
defaultSet: 'mds',
aliases,
sets: {
mds,
mdi
},
},
}) |
Problem to solve
the new Material Icons collection is now "Material Symbols"
Proposed solution
adding Material Symbols option/differentiate by icon name
updating the class name
The text was updated successfully, but these errors were encountered: