heroicons README

The project's README from github.com/tailwindlabs/heroicons. As one markdown file: README.md.

Heroicons

Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS.
Available as basic SVG icons and via first-party React and Vue libraries.

Browse at Heroicons.com →

Latest Release License

Basic Usage

The quickest way to use these icons is to simply copy the source for the icon you need from heroicons.com and inline it directly into your HTML:

<svg
  class="size-6 text-gray-500"
  fill="none"
  viewBox="0 0 24 24"
  stroke="currentColor"
  stroke-width="2"
>
  <path
    stroke-linecap="round"
    stroke-linejoin="round"
    d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
  />
</svg>

Both icon styles are preconfigured to be stylable by setting the color CSS property, either manually or using utility classes like text-gray-500 in a framework like Tailwind CSS.

React

First, install @heroicons/react from npm:

npm install @heroicons/react

Now each icon can be imported individually as a React component:

import { BeakerIcon } from '@heroicons/react/24/solid'

function MyComponent() {
  return (
    <div>
      <BeakerIcon className="size-6 text-blue-500" />
      <p>...</p>
    </div>
  )
}

The 24x24 outline icons can be imported from @heroicons/react/24/outline, the 24x24 solid icons can be imported from @heroicons/react/24/solid, the 20x20 solid icons can be imported from @heroicons/react/20/solid, and 16x16 solid icons can be imported from @heroicons/react/16/solid.

Icons use an upper camel case naming convention and are always suffixed with the word Icon.

Browse the full list of icon names on UNPKG →

Vue

First, install @heroicons/vue from npm:

npm install @heroicons/vue

Now each icon can be imported individually as a Vue component:

<template>
  <div>
    <BeakerIcon class="size-6 text-blue-500" />
    <p>...</p>
  </div>
</template>

<script setup>
import { BeakerIcon } from '@heroicons/vue/24/solid'
</script>

The 24x24 outline icons can be imported from @heroicons/vue/24/outline, the 24x24 solid icons can be imported from @heroicons/vue/24/solid, the 20x20 solid icons can be imported from @heroicons/vue/20/solid, and the 16x16 solid icons can be imported from @heroicons/vue/16/solid.

Icons use an upper camel case naming convention and are always suffixed with the word Icon.

Browse the full list of icon names on UNPKG →

Contributing

While we absolutely appreciate anyone's willingness to try and improve the project, we're currently only interested in contributions that fix bugs, for example things like incorrect TypeScript types, or fixing an icon that's been exported with a fill instead of a stroke, etc.

We're not accepting contributions for new icons or adding support for other frameworks like Svelte or SolidJS. Instead we encourage you to release your own icons in your own library, and create your own packages for any other frameworks you'd like to see supported.

License

This library is MIT licensed.

heroicons (tailwindlabs/heroicons)

Searching Database…

23.9K ·GitHub
这是什么?Heroicons 是一套免费、精心手工设计的图标,采用 MIT 许可证,以 SVG 格式提供,适用于界面开发。它由 Tailwind CSS 的作者制作,既可以直接使用纯 SVG 文件,也提供官方的 React 和 Vue 组件库。
这是 UI 框架,还是只是一个图标集?它只是一个图标库,不是 UI 框架,包含纯 SVG 文件以及 React 和 Vue 组件包。你可以自行通过设置 CSS 的 color 属性来给图标上色,也可以选择使用 Tailwind 工具类。
我怎么把这些图标添加到项目里?对于 React 或 Vue,运行 npm install @heroicons/react(或 @heroicons/vue),然后将每个图标作为组件导入,例如从 @heroicons/react/24/outline 导入。对于普通 HTML,只需从 heroicons.com 复制你需要的图标的 SVG 源代码,并直接内联到页面中。
我能请求添加新图标,或者让它支持 Svelte 之类的其他框架吗?不能。维护者只接受修复错误的贡献,例如修正错误的 TypeScript 类型,或修正图标导出时使用了 fill 而不是 stroke 的问题。新图标以及对 Svelte、SolidJS 等框架的支持不会被接受,如果需要,你需要自己发布一个库。
Heroicons 提供哪些尺寸和样式的图标?共四种变体:24x24 轮廓版(outline)、24x24 实心版(solid)、20x20 实心版和 16x16 实心版。每种都可以从自己的子路径导入,例如 @heroicons/react/24/outline。
图标组件的名字是怎么命名的?图标采用大驼峰命名法,并且名字总是以单词 'Icon' 结尾,例如 BeakerIcon。
在哪里可以浏览所有可用的图标名称?完整的图标名称列表可以在 UNPKG 上浏览,也可以在 heroicons.com 上直观查看。
Size
2.6 MB
Stars
23.9K
Age
6y
Commits · 90 Days