npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

svelte-materialdesign-icons

v0.7.4

Published

Material Design SVG Icon components for Svelte

Downloads

401

Readme

Svelte Materialdesign Icons

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.

Repo

GitHub Repo

Original source

Templarian/MaterialDesign

License

Svelte-Materialdesign-Icons License

Templarian/MaterialDesign LICENSE

Installation

pnpm i -D svelte-materialdesign-icons

Usages

In a svelte file:

<script>
  import { Icon } from 'svelte-materialdesign-icons';
</script>

<Icon name="bucket" />

Props

  • @prop name;
  • @prop width = "24";
  • @prop height = "24";
  • @prop role = 'img';
  • @prop color = 'currentColor'
  • @prop ariaLabel='icon name'

IDE support

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.

Size

Use the width and height props to change the size of icons.

<Icon name="bucket" width="100" height="100" />

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:

<Icon name="bucket" class="shrink-0 h-20 w-20" />

CSS HEX Colors

Use the color prop to change colors with HEX color code.

<Icon name="bucket" color="#c61515" />

CSS frameworks suport

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:

<Icon name="bucket" class="text-red-700 inline m-1" />

Bootstrap examples:

<Icon name="bucket" class="position-absolute top-0 px-1" />

Dark mode

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.

<Icon name="bucket"  class="text-blue-700 dark:text-red-500" />

aria-label

All icons have aria-label. For example bucket has aria-label="bucket". Use ariaLabel prop to modify the aria-label value.

<Icon name="bucket" ariaLabel="red bucket" color="#c61515"/>

Unfocusable icon

If you want to make an icon unfocusable, add tabindex="-1".

<Icon name="bucket"  tabindex="-1" />

Events

All icons have the following events:

  • on:click
  • on:keydown
  • on:keyup
  • on:focus
  • on:blur
  • on:mouseenter
  • on:mouseleave
  • on:mouseover
  • on:mouseout

Passing down other attributes

You can pass other attibutes as well.

<Icon name="bucket"  tabindex="0" />

Using svelte:component

<svelte:component this="{Icon}" name="bucket" />

Using onMount

<script>
  import {Icon} from 'svelte-materialdesign-icons';
  import { onMount } from 'svelte';
  const props = {
    name: 'bucket',
    size: '50',
    color: '#ff0000'
  };
  onMount(() => {
    const icon = new Icon({ target: document.body, props });
  });
</script>

Import all

Use import {Icon, icons} from 'svelte-materialdesign-icons';.

<script>
  import {Icon, icons} from 'svelte-materialdesign-icons';
</script>

{#each Object.keys(icons) as name}
<div class="flex gap-4 items-center text-lg">
  <Icon name={name} class="shrink-0"/>
  {name}
</div>
{/each}

Other icons

Svelte-Icon-Sets