# Icon
### Intro
The font-based icon set that can be used via the Icon component or referenced in other components via the `icon` attribute.
### Install
Register component globally via `app.use`, refer to [Component Registration](#/en-US/advanced-usage#zu-jian-zhu-ce) for more registration ways.
```js
import { createApp } from 'vue';
import { Icon } from 'vant';
const app = createApp();
app.use(Icon);
```
## Usage
### Basic Usage
Use `name` prop to set icon name or icon URL.
```html
```
### Using URL
You can directly passing an image URL to the `name` props.
```html
```
### Show Badge
Use `dot` prop, a small red dot will be displayed in the upper right corner of the icon.
Use `badge` prop, the badge will be displayed in the upper right corner of the icon.
```html
```
### Icon Color
Use `color` prop to set icon color.
```html
```
### Icon Size
Use `size` prop to set icon size.
```html
```
### Add custom iconfont
```css
@font-face {
font-family: 'my-icon';
src: url('./my-icon.ttf') format('truetype');
}
.my-icon {
font-family: 'my-icon';
}
.my-icon-extra::before {
content: '\e626';
}
```
```html
```
## API
### Props
| Attribute | Description | Type | Default |
| ------------ | ------------------------ | ------------------ | ---------- |
| name | Icon name or URL | _string_ | `''` |
| dot | Whether to show red dot | _boolean_ | `false` |
| badge | Content of the badge | _number \| string_ | `''` |
| color | Icon color | _string_ | `inherit` |
| size | Icon size | _number \| string_ | `inherit` |
| class-prefix | ClassName prefix | _string_ | `van-icon` |
| tag | HTML Tag of root element | _string_ | `i` |
### Events
| Event | Description | Arguments |
| ----- | ---------------------------- | ------------------- |
| click | Emitted when icon is clicked | _event: MouseEvent_ |