Material Design SVG Icon components for Svelte
npm install svelte-materialdesign-icons6980+ Material Design SVG icon components for Svelte.
Thank you for considering my open-source package. If you use it in a commercial project, please support me by sponsoring me on GitHub: https://github.com/sponsors/shinokada. Your support helps me maintain and improve this package for the benefit of the community.
Svelte-Materialdesign-Icons License
Templarian/MaterialDesign LICENSE
``sh`
pnpm i -D svelte-materialdesign-icons
In a svelte file:
`html
`
- @prop name;
- @prop width = "24";
- @prop height = "24";
- @prop role = 'img';
- @prop color = 'currentColor'
- @prop ariaLabel='icon name'
If you are using an LSP-compatible editor, such as VSCode, Atom, Sublime Text, or Neovim, hovering over a component name will display a documentation link, features, props, events, and an example.
Use the width and height props to change the size of icons.
`html`
If you are using Tailwind CSS, you can add a custom size using Tailwind CSS by including the desired classes in the class prop. For example:
`html`
Use the color prop to change colors with HEX color code.
`html`
You can apply CSS framework color and other attributes directly to the icon component or its parent tag using the class prop.
Tailwind CSS example:
`html`
Bootstrap examples:
`html`
If you are using the dark mode on your website with Tailwind CSS, add your dark mode class to the class prop.
Let's use dark for the dark mode class as an example.
`html`
All icons have aria-label. For example bucket has aria-label="bucket".ariaLabel
Use prop to modify the aria-label value.
`html`
If you want to make an icon unfocusable, add tabindex="-1".
`html`
All icons have the following events:
- on:click
- on:keydown
- on:keyup
- on:focus
- on:blur
- on:mouseenter
- on:mouseleave
- on:mouseover
- on:mouseout
You can pass other attibutes as well.
`html`
`html`
`html`
Use import {Icon, icons} from 'svelte-materialdesign-icons';.
`html
{#each Object.keys(icons) as name}