Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

File icons in the file tree.

NotificationsYou must be signed in to change notification settings

uiwjs/file-icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM DownloadsjsDelivr CDNreleases versionLICENSENPM Version

File icons in the file tree usingvscode-material-icon-theme.

Visithttps://uiwjs.github.io/file-icons/ and check out the search feature, which has keywords identifying common icon names and styles. For example, if you search for "swift" we call up every icon that could possibly be used as an arrow. We've also included each icon's class name for easy copy/pasting when you're developing!

They are free to use and licensed underMIT. Use them wherever you see fit, personal or commercial.

Install

npm install @uiw/file-icons --save

Usage

You can usehttps://uiwjs.github.io/file-icons/ to easily find the icon you want to use. Once you've copied the desired icon's CSS classname, simply add the icon and icon's classname, such asapple to an HTML element.

Suppose the font name is defined asffont, The default home page isunicode, Will generate:

font-class.htmlindex.htmlsymbol.htmlreactffont.jsonffont.cssffont.eotffont.lessffont.svgffont.symbol.svgffont.ttfffont.woffffont.woff2

Preview demofont-class.html,symbol.html anndindex.html. Automatically generated styleffont.css andffont.less.

symbol svg

<svgclass="icon"aria-hidden="true">  <usexlink:href="node_modules/@uiw/file-icons/fonts/ffont.symbol.svg#ffont-javascript"></use></svg>

Unicode

<style>.iconfont {font-family:"ffont"!important;font-size:16px;font-style: normal;-webkit-font-smoothing: antialiased;-webkit-text-stroke-width:0.2px;-moz-osx-font-smoothing: grayscale;}</style><spanclass="iconfont">&#59907;</span>

Class Name

Support for.less and.css styles references.

<linkrel="stylesheet"type="text/css"href="node_modules/@uiw/file-icons/fonts/ffont.css"><iclass="ffont-javascript"></i>

Used in React

Icons are used as components.v1.3.0+ support.

import{Android}from'@uiw/file-icons';// Orimport{Android}from'@uiw/file-icons/Alipay';<Androidstyle={{fill:'red'}}/><Androidheight="36"/>

To use SVG images as React components directly, webpack loader support is required.

Install dependencies:

yarn add @svgr/webpack file-loader

Configure webpack loader:

// webpack.config.js{test:/\.svg$/,use:[{loader:require.resolve('@svgr/webpack'),options:{prettier:false,svgo:false,svgoConfig:{plugins:[{removeViewBox:false}],},titleProp:true,ref:true,},},{loader:require.resolve('file-loader'),options:{name:'static/media/[name].[hash].[ext]',},},],issuer:{and:[/\.(ts|tsx|js|jsx|md|mdx)$/],},},

You can then import the SVG as a React component like this:

import{ReactComponentasComLogo}from'@uiw/file-icons/icon/android.svg';<ComLogo/>

Custom Icon Component

Create anIcon component.

importReactfrom'react';importsvgPathsfrom'@uiw/file-icons/fonts/ffont.json';constrenderSvgPaths=(type)=>{constpathStrings=svgPaths[type];if(pathStrings==null){returnnull}returnpathStrings.map((d,i)=><pathkey={i}d={d}fillRule="evenodd"/>)}exportdefaultclassIconextendsReact.PureComponent{render(){const{ type, color}=this.props;if(type==null||typeoftype==="boolean"){returnnull;}return(<svgfill={color}viewBox={`0 0 24 24`}>{this.renderSvgPaths(type)}</svg>);}}

Use theIcon component:

constdemo=()=>{return(<Icontype="android"/>)}

Contributors

As always, thanks to our amazing contributors!

Made withgithub-action-contributors.

License

Created Bysvgtofont, Licensed under theMIT License.

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp