
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mdi-paths-split
Advanced tools
STATUS: Moved to @slimr/mdi-paths
Material Design Icon paths for any TS/JS project, packaged as single components.
@mdi/svg this was generated fromnpm install mdi-paths-split
# or if you use Yarn
yarn add mdi-paths-split
Just search for an icon on materialdesignicons.com and look for its name.
The name translates to PascalCase in mdi-paths-split.
Also it's possible to import with an alias. You can find them on the detail page of the respective icon.
Simplest Usage:
import HomePath from 'mdi-paths-split/Home'
export function HomeIcon ({ color = 'currentColor', size = 24, ...props }) {
const className = 'mdi-icon ' + (props.class || props.className || '');
return (
<svg {...props} class={className} width={size} height={size} fill={color} viewBox="0 0 24 24">
<path d={HomePath} />
</svg>
);
}
With Lazy-Loading/Code-Splitting and blank placeholder:
export function HomeIcon ({ color = 'currentColor', size = 24, ...props }) {
const className = 'mdi-icon ' + (props.class || props.className || '');
const [path, setPath] = useState('')
useEffect(() => {
import('mdi-paths-split/Home'))().then((module: any) => setPath(module.default))
}, [])
return (
<svg {...props} class={className} width={size} height={size} fill={color} viewBox="0 0 24 24">
<path d={path} />
</svg>
);
}
And here is how I use it. I made a helper component and factory to make it crazy easy to add more icons while simultaneously reducing line-count per-icon. Notice how each icon is code-split and lazy loaded with an empty placeholder!!!!
import {Account, Counter, Home} from '~/components/Icons'
export default function HeaderLogo() {
return <div>
<Account />
<Counter />
<Home />
</div>
}
Source of helper ~/components/Icons:
import { h } from 'preact';
import { useEffect, useState } from 'preact/hooks';
export const Account = I(() => import('mdi-paths-split/CardAccountDetailsOutline'))
export const Counter = I(() => import('mdi-paths-split/Counter'))
export const Home = I(() => import('mdi-paths-split/HomeOutline'))
// ... add as many as you want
function I(lazyPath: LazyPathType) { // aka Icon Factory, shortened to be easier to read
return (props: IconProps) => <LazySvg lazyPath={lazyPath} {...props} />
}
type IconProps = Omit<LazySvgProps, 'lazyPath'>
function LazySvg({ lazyPath, color = 'currentColor', size = 24, ...props }: LazySvgProps) {
const className = 'mdi-icon ' + (props.class || props.className || '');
const [path, setPath] = useState('')
useEffect(() => { lazyPath().then((module: any) => setPath(module.default)) }, [])
return (
<svg {...props} class={className} width={size} height={size} fill={color} viewBox="0 0 24 24">
<path d={path} />
</svg>
);
};
type LazyPathType = () => Promise<any>
interface LazySvgProps {
color?: string
size?: number | string
class?: string
className?: string
children?: never
lazyPath: LazyPathType
}
FAQs
Material Design Icon paths Javascript
We found that mdi-paths-split demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.