vant/packages/icon/en-US.md

1.1 KiB
Raw Blame History

Icon

Install

import { Icon } from 'vant';

Vue.use(Icon);

Usage

Basic Usage

View all usable icons on the right.

<van-icon name="success" />

Use local font file

Icon uses font file in yzcdn.cn by defaultif you want to use the local font fileplease import the following css file.

import 'vant/lib/icon/local.css';

Add custom iconfont

@font-face {
  font-family: 'custom-iconfont';
  src: url('./iconfont.ttf') format('truetype');
}

.van-icon {
  font-family: 'vant-icon', 'custom-iconfont' !important;
}

.van-icon-extra:before {
  content: '\e626';
}
<van-icon name="extra" />

API

Attribute Description Type Default
name Icon name String ''
info Info message `String Number`
color Icon color String inherit
size Icon size String inherit
class-prefix ClassName prefix String van-icon

Event

Event Description Arguments
click Triggered when click icon -