6980+ 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
pnpm i -D svelte-materialdesign-icons
In a svelte file:
<script>
import { Bucket } from 'svelte-materialdesign-icons';
</script>
<Bucket />
TODO
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 size
prop to change the size of icons.
<Adjust size="40" />
<ArrowUpBoldOutline size="50" />
<Bucket size="60" />
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:
<Adjust class="shrink-0 h-20 w-20" />
Use the color
prop to change colors with HEX color code.
<Card color="#c61515" />
<ChatPlus color="#3759e5" />
<DataMatrix color="#3fe537" />
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:
<Adjust class="h-24 w-24 text-blue-700 mr-4" />
Bootstrap examples:
<Adjust class="position-absolute top-0 px-1" />
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.
<Adjust class="text-blue-700 dark:text-red-500" />
All icons have aria-label. For example AccessPointOff
has aria-label="access point off"
.
Use ariaLabel
prop to modify the aria-label
value.
<AccessPointOff ariaLabel="Access off" />
If you want to make an icon unfocusable, add tabindex="-1"
.
<AccessPointOff tabindex="-1" />
All icons have the following events:
You can pass other attibutes as well.
<AccessPointOff tabindex="0" />
<script>
import { ChatPlus } from 'svelte-materialdesign-icons';
const props = {
size: '50',
color: '#ff0000'
};
</script>
<svelte:component this="{ChatPlus}" />
<script>
import { ChatPlus } from 'svelte-materialdesign-icons';
import { onMount } from 'svelte';
onMount(() => {
const icon = new ChatPlus({ target: document.body, props });
});
</script>
Use import * as Icon from 'svelte-materialdesign-icons
.
<script>
import * as Icon from 'svelte-materialdesign-icons';
</script>
<Icon.Bucket />
<Icon.Card />
<h1>Size</h1>
<Icon.Bucket size="30" />
<Icon.Card size="40" />
<h1>CSS HEX color</h1>
<Icon.Bucket color="#c61515" size="40" />
<h1>Tailwind CSS</h1>
<Icon.Bucket class="text-blue-500" />
<Icon.Card class="text-pink-700" />