2.1.43 • Published 8 months ago

@slimr/mdi-paths v2.1.43

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

🪶 @slimr/mdi-paths npm package

Material Design Icon paths for any TS/JS project, packaged as single files default export = path.

Compared to Iconify

  • Has all of the mdi aliases
  • Uses Lazy ESM Imports instead of fetching from CDN/internet
  • Is smaller bundle impact - icon files are smaller, React component smaller

Features

  • Lazy ESM Imports instead of fetching from CDN/internet
  • Each icon is a seperate Javascript module, named to match the name in https://materialdesignicons.com, so easy to find
  • For React fans, you can use LazyIconSvg or IconSvg from @slimr/mdi-paths/react.

Context

@slimr is a set of slim React (hence '@slimr') libs. Check them all out on github!

Installation

npm install @slimr/mdi-paths

Usage

Just search for an icon on materialdesignicons.com and look for its name.

The name translates to PascalCase in @slimr/mdi-paths.

Also it's possible to import with an alias. You can find them on the detail page of the respective icon.

For React, I recommend you use the bundled react components, LazyIconSvg and IconSvg.

Example with LazyIconSvg:

// icon.tsx
import {LazyIconSvg, LazyIconSvgProps} from '@slimr/mdi-paths/react'

const icons = {
  home: () => import('@slimr/mdi-paths/Home'),
}

type IconKeys = keyof typeof icons
type IconProps = Omit<LazyIconSvgProps, 'name' | 'svgPathImport'> & {name: IconKeys}

export function Icon({name, ...props}: IconProps) {
  return <LazyIconSvg pathImporter={icons[name]} {...props} />
}

Dependencies, References & Inspirations

  • mdi-react - The generator in this package was adapted from that one (Thanks!). This package achieves similar things but does so with much less bandwidth penalty per icon.
  • materialdesignicons.com - Where to browse icons
  • @mdi/js - Very similar to this lib, but puts all the paths in one file
  • @mdi/svg - Where this lib gets the icons from
2.1.27

9 months ago

2.1.28

9 months ago

2.1.26

10 months ago

2.1.43

8 months ago

2.1.41

8 months ago

2.1.42

8 months ago

2.1.40

8 months ago

2.1.29

9 months ago

2.1.38

8 months ago

2.1.39

8 months ago

2.1.34

8 months ago

2.1.35

8 months ago

2.1.32

8 months ago

2.1.33

8 months ago

2.1.30

9 months ago

2.1.31

8 months ago

2.1.19

1 year ago

2.1.25

1 year ago

2.1.23

1 year ago

2.1.24

1 year ago

2.1.21

1 year ago

2.1.8

1 year ago

2.1.22

1 year ago

2.1.7

1 year ago

2.1.20

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

2.1.17

1 year ago

2.1.14

1 year ago

2.1.12

1 year ago

2.1.13

1 year ago

2.1.10

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.9

1 year ago