简体中文

图标

图标组件。

基础
import React, {Component} from 'react';
import {Icon} from 'hana-ui';
import randomColor from 'randomcolor';
import ExampleBlock from 'demo/ExampleBlock';
import getIcons from './getIcons';

const result = getIcons();

const itemStyle = {
  display: 'inline-block',
  textAlign: 'center',
  width: 200,
  fontSize: 14,
  marginBottom: 20
};
/**
 * @en
 * Base
 *
 * icons
 *
 * @cn
 * 基础
 *
 * 图标
 */
export default class ExampleBase extends Component {
  render() {
    const items = result.map(item => {
      if (!item) {
        return null;
      }
      const color = randomColor({
        luminosity: 'dark',
        format: 'rgb'
      });
      return (
        <div style={itemStyle} key={item.name}>
          <Icon type={item.name} style={{fontSize: 40}} color={color} />
          <p style={{color, margin: '10px 0'}}>{item.name}<span style={{color: '#666'}}>({item.unicode})</span></p>
        </div>
      );
    });
    return (
      <div>
        <ExampleBlock
          en={<p>{'default:'}</p>}
          cn={<p>{'默认:'}</p>}
        >
          <Icon type="snowflake-o" />
        </ExampleBlock>

        <ExampleBlock
          en={<p>{'custom size and color:'}</p>}
          cn={<p>{'自定义尺寸和颜色:'}</p>}
        >
          <Icon type="snowflake-o" color="#f60" style={{fontSize: 40}} />
        </ExampleBlock>

        <ExampleBlock
          en={<p>{'icon list:'}</p>}
          cn={<p>{'图标列表:'}</p>}
        >
          {items}
        </ExampleBlock>
      </div>
    );
  }
}

图标

默认:

自定义尺寸和颜色:

图标列表:

snowflake-o(\e600)

flower(\e601)

smile(\e642)

sad(\e6da)

warn(\e625)

error(\e60e)

success(\e60c)

close(\e633)

edit(\e619)

clover(\e6e7)

leaf-left(\e6e8)

leaf-right(\e66a)

leaf(\e657)

gomi(\e60b)

menu(\e607)

preview(\e60f)

backward(\e63d)

deploy(\e688)

save(\e702)

gear(\e662)

up(\e703)

down(\e608)

left(\e639)

right(\e704)

date(\e60d)

time(\e613)

draft(\e647)

package(\e61f)

online(\e71c)

offline(\e71d)

reuse(\e64e)

expand(\e655)

contract(\e734)

plus(\e615)

add(\e60a)

picture(\e674)

video(\e659)

list(\e603)

data(\e664)

chat(\e612)

note(\e602)

log(\e606)

gift(\e604)

users(\e65a)

chart(\e605)

heart(\e631)

heart-o(\e6b5)

paint(\e656)

lucky(\e641)

copy(\e610)

play(\e614)

pause(\e711)

volume-full(\e609)

volume-zero(\e643)

template(\e611)

cinema(\e6c2)

full-screen(\e61b)

media-pre(\e618)

media-next(\e8a7)

media-cycle(\e672)

media-repeat(\ebae)

media-normal(\e6b7)

media-random(\ebbb)

vote(\e61a)

github(\e6c7)

mum(\e637)

issue(\e620)

属性说明

属性名 类型 默认值 说明
type * string 图标的种类
color string 图标的颜色
style object 图标的style
size enum:
 'small'
 'middle'
 'large'
'middle' 图标的尺寸
className string 图标的class

未在文档中说明的属性将会被自动加到根元素或form元素上。