nuke-iconfont

v2.3.12
iconfont
nuke iconfont

Iconfont

  • category: API
  • chinese: iconfont
  • type: API

Design

This component provides a static method to define an icon font set. SVG icons is not supported by now.

Notice: This feature is experientmental and if font source is a remote ttf file, icons may not be rendered at the first time page showing. To avoid conflicts of network and icon render, we sugguest to use pictures instead , or pre-load font files (You can also integrate them into app source).

API

Iconfont

Iconfont({
  name: 'your-unique-font-name',
  url: 'https://at.alicdn.com/t/font_1474198576_7440977.ttf'
});

// \u modeļ¼Œcode must be variable
const code = '\ue60f';
<Text style={{ fontSize: 40, fontFamily: 'your-unique-font-name' }}>{code}</Text>;

// or
<Text style={{ fontSize: 40, fontFamily: 'your-unique-font-name' }}>&#xe600;</Text>;

options

  • options.name : iconfont name, for example 'your-unique-font-name'
  • options.url : iconfont path, currently support ttf and woff

formatUnicode

const { formatUnicode } = Iconfont;
formatUnicode('&#xe600;'); // \ue600

Transform icon html code into unicode to fit both weex and web

npm i nuke-iconfont

Metadata

Downloads