Icon 图标

Element Plus 提供了一套常用的图标集合。

使用图标

安装

使用包管理器

# 选择一个你喜欢的包管理器

# NPM
$ npm install @element-plus/icons-vue
# Yarn
$ yarn add @element-plus/icons-vue
# pnpm
$ pnpm install @element-plus/icons-vue

基础用法

WARNING

由于 HTML 标准已经定义了一个名为 menu 的标签,如果你注册的 Menu 无法正常工作,则需要使用别名来渲染图标。

<!-- 使用 el-icon 标签来包裹 SVG 图标 -->
<template>
  <div>
    <el-icon :size="size" :color="color">
      <edit />
    </el-icon>
    <!-- 也可以直接使用图标标签,无需父标签包裹 -->
    <edit />
  </div>
</template>

结合 el-icon 使用

el-icon 为原始的 SVG 图标提供额外的属性,更多细节详见结尾。

<template>
  <p>
    当增加了 <b>is-loading</b> 类时,图标可以每两秒完整转 360
    度,你也可以覆写该属性
  </p>
  <el-icon :size="20">
    <edit />
  </el-icon>
  <el-icon color="#409EFC" class="no-inherit">
    <share />
  </el-icon>
  <el-icon>
    <delete />
  </el-icon>
  <el-icon class="is-loading">
    <loading />
  </el-icon>
  <el-button type="primary">
    <el-icon style="vertical-align: middle;">
      <search />
    </el-icon>
    <span style="vertical-align: middle;"> 搜索 </span>
  </el-button>
</template>

通过添加额外的类名 is-loading,你的图标就可以在 2 秒内旋转 360 度,但让你也可以自己改写想要的动画。

直接使用 SVG 图标

<template>
  <div style="font-size: 20px">
    <!-- SVG 图标默认不携带任何属性 -->
    <!-- 你需要直接提供它们 -->
    <edit style="width: 1em; height: 1em; margin-right: 8px" />
    <share style="width: 1em; height: 1em; margin-right: 8px" />
    <delete style="width: 1em; height: 1em; margin-right: 8px" />
    <search style="width: 1em; height: 1em; margin-right: 8px" />
  </div>
</template>

图标集合

TIP

只要你安装了图标组件库,即可在任意版本中使用 SVG 图标

您可以点击图标复制代码

Copy icon code
  • AddLocation
  • Aim
  • AlarmClock
  • Apple
  • ArrowDownBold
  • ArrowDown
  • ArrowLeftBold
  • ArrowLeft
  • ArrowRightBold
  • ArrowRight
  • ArrowUpBold
  • ArrowUp
  • Avatar
  • Back
  • Baseball
  • Basketball
  • BellFilled
  • Bell
  • Bicycle
  • BottomLeft
  • BottomRight
  • Bottom
  • Bowl
  • Box
  • Briefcase
  • BrushFilled
  • Brush
  • Burger
  • Calendar
  • CameraFilled
  • Camera
  • CaretBottom
  • CaretLeft
  • CaretRight
  • CaretTop
  • Cellphone
  • ChatDotRound
  • ChatDotSquare
  • ChatLineRound
  • ChatLineSquare
  • ChatRound
  • ChatSquare
  • Check
  • Checked
  • Cherry
  • Chicken
  • CircleCheckFilled
  • CircleCheck
  • CircleCloseFilled
  • CircleClose
  • CirclePlusFilled
  • CirclePlus
  • Clock
  • CloseBold
  • Close
  • Cloudy
  • CoffeeCup
  • Coffee
  • Coin
  • ColdDrink
  • CollectionTag
  • Collection
  • Comment
  • Compass
  • Connection
  • Coordinate
  • CopyDocument
  • Cpu
  • CreditCard
  • Crop
  • DArrowLeft
  • DArrowRight
  • DCaret
  • DataAnalysis
  • DataBoard
  • DataLine
  • DeleteFilled
  • DeleteLocation
  • Delete
  • Dessert
  • Discount
  • DishDot
  • Dish
  • DocumentAdd
  • DocumentChecked
  • DocumentCopy
  • DocumentDelete
  • DocumentRemove
  • Document
  • Download
  • Drizzling
  • EditPen
  • Edit
  • ElemeFilled
  • Eleme
  • Expand
  • Failed
  • Female
  • Files
  • Film
  • Filter
  • Finished
  • FirstAidKit
  • Flag
  • Fold
  • FolderAdd
  • FolderChecked
  • FolderDelete
  • FolderOpened
  • FolderRemove
  • Folder
  • Food
  • Football
  • ForkSpoon
  • Fries
  • FullScreen
  • GobletFull
  • GobletSquareFull
  • GobletSquare
  • Goblet
  • GoodsFilled
  • Goods
  • Grape
  • Grid
  • Guide
  • Headset
  • HelpFilled
  • Help
  • Histogram
  • HomeFilled
  • HotWater
  • House
  • IceCreamRound
  • IceCreamSquare
  • IceCream
  • IceDrink
  • IceTea
  • InfoFilled
  • Iphone
  • Key
  • KnifeFork
  • Lightning
  • Link
  • List
  • Loading
  • LocationFilled
  • LocationInformation
  • Location
  • Lock
  • Lollipop
  • MagicStick
  • Magnet
  • Male
  • Management
  • MapLocation
  • Medal
  • Menu
  • MessageBox
  • Message
  • Mic
  • Microphone
  • MilkTea
  • Minus
  • Money
  • Monitor
  • MoonNight
  • Moon
  • MoreFilled
  • More
  • MostlyCloudy
  • Mouse
  • Mug
  • MuteNotification
  • Mute
  • NoSmoking
  • Notebook
  • Notification
  • Odometer
  • OfficeBuilding
  • Open
  • Operation
  • Opportunity
  • Orange
  • Paperclip
  • PartlyCloudy
  • Pear
  • PhoneFilled
  • Phone
  • PictureFilled
  • PictureRounded
  • Picture
  • PieChart
  • Place
  • Platform
  • Plus
  • Pointer
  • Position
  • Postcard
  • Pouring
  • Present
  • PriceTag
  • Printer
  • Promotion
  • QuestionFilled
  • Rank
  • ReadingLamp
  • Reading
  • RefreshLeft
  • RefreshRight
  • Refresh
  • Refrigerator
  • RemoveFilled
  • Remove
  • Right
  • ScaleToOriginal
  • School
  • Scissor
  • Search
  • Select
  • Sell
  • SemiSelect
  • Service
  • SetUp
  • Setting
  • Share
  • Ship
  • Shop
  • ShoppingBag
  • ShoppingCartFull
  • ShoppingCart
  • Smoking
  • Soccer
  • SoldOut
  • SortDown
  • SortUp
  • Sort
  • Stamp
  • StarFilled
  • Star
  • Stopwatch
  • SuccessFilled
  • Sugar
  • Suitcase
  • Sunny
  • Sunrise
  • Sunset
  • SwitchButton
  • Switch
  • TakeawayBox
  • Ticket
  • Tickets
  • Timer
  • ToiletPaper
  • Tools
  • TopLeft
  • TopRight
  • Top
  • TrendCharts
  • Trophy
  • TurnOff
  • Umbrella
  • Unlock
  • UploadFilled
  • Upload
  • UserFilled
  • User
  • Van
  • VideoCameraFilled
  • VideoCamera
  • VideoPause
  • VideoPlay
  • View
  • WalletFilled
  • Wallet
  • WarningFilled
  • Warning
  • Watch
  • Watermelon
  • WindPower
  • ZoomIn
  • ZoomOut

Icon 属性

| 属性 | 说明 | 类型 | 可选值 | 默认值 | | ----- | --------------------------- | ------------------------------ | ------ | ------- | ------- | | color | svg 的 fill 颜色 | Pick<CSSProperties, 'color'> | - | inherit | | size | SVG 图标的大小,size x size | number/ | string | - | inherit |

Icon 插槽

名称说明
自定义默认内容