@astraicons/react

中文文档
1.7.0发布于 2025/12/31MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 8539

A comprehensive icon set designed for websites, applications, social networks, and print media, tailored specifically for UI Astra.

原始使用文档
文档目录24 节
  1. Installation
  2. Usage
  3. Icon Styles
  4. Linear (288 icons)
  5. Bold (288 icons)
  6. Duotone (288 icons)
  7. Brand (18 icons)
  8. 3D (32 icons)
  9. Props
  10. Examples
  11. With Tailwind CSS
  12. With inline styles
  13. With accessibility title
  14. As a button icon
  15. TypeScript Support
  16. Tree Shaking
  17. Package Info
  18. Available Icons
  19. Browser Support
  20. Contributing
  21. Related Packages
  22. Credits
  23. License
  24. Links

@astraicons/react

AstraIcons

Beautiful React icons from the Astra Icons collection. 900+ icons across 5 styles.

npm version npm downloads License

Installation

npm install @astraicons/react
# or
yarn add @astraicons/react
# or
pnpm add @astraicons/react

Usage

Import icons from their respective style directories:

import { HomeIcon } from '@astraicons/react/linear';
import { HeartIcon } from '@astraicons/react/bold';
import { StarIcon } from '@astraicons/react/duotone';
import { AppleIcon } from '@astraicons/react/brand';
import { CubeIcon } from '@astraicons/react/3d';

function MyComponent() {
  return (
    <div>
      <HomeIcon className="w-6 h-6" />
      <HeartIcon className="w-6 h-6 text-red-500" />
      <StarIcon className="w-6 h-6 text-yellow-500" />
      <AppleIcon className="w-8 h-8" />
      <CubeIcon className="w-8 h-8 text-purple-500" />
    </div>
  );
}

Icon Styles

Linear (288 icons)

Outline icons with 1.5px stroke width. Perfect for modern, minimalist interfaces.

import { ActivityIcon, BellIcon, CameraIcon } from '@astraicons/react/linear';

Bold (288 icons)

Filled or bold stroke icons for emphasis and better visibility at smaller sizes.

import { ActivityIcon, BellIcon, CameraIcon } from '@astraicons/react/bold';

Duotone (288 icons)

Two-tone icons that combine filled and outline styles for depth and visual interest.

import { ActivityIcon, BellIcon, CameraIcon } from '@astraicons/react/duotone';

Brand (18 icons)

Company and service logos including social media platforms and popular brands.

import { AppleIcon, GoogleIcon, TwitterIcon } from '@astraicons/react/brand';

3D (32 icons)

Modern three-dimensional style icons with depth and perspective for contemporary interfaces.

import { CubeIcon, FolderIcon, BoxIcon } from '@astraicons/react/3d';

Props

All icons accept standard SVG element props:

interface IconProps extends React.SVGProps<SVGSVGElement> {
  title?: string;      // Accessibility title
  titleId?: string;    // ID for the title element
  className?: string;  // CSS classes
  style?: React.CSSProperties; // Inline styles
}

Examples

With Tailwind CSS

<HomeIcon className="w-8 h-8 text-blue-500 hover:text-blue-600 transition-colors" />

With inline styles

<HomeIcon style={{ width: 32, height: 32, color: '#3B82F6' }} />

With accessibility title

<HomeIcon title="Navigate to home" />

As a button icon

<button className="flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded">
  <SaveIcon className="w-5 h-5" />
  Save Changes
</button>

TypeScript Support

All icons are fully typed. TypeScript will provide autocomplete for all available icons and their props.

import { HomeIcon } from '@astraicons/react/linear';
import type { FC } from 'react';

const MyComponent: FC = () => {
  return <HomeIcon className="w-6 h-6" />;
};

Tree Shaking

This package is optimized for tree shaking. Only the icons you import will be included in your bundle.

// ✅ Good - only imports what you need
import { HomeIcon } from '@astraicons/react/linear';

// ❌ Avoid - imports entire style directory
import * as Icons from '@astraicons/react/linear';

Package Info

  • Package Size: ~14MB total (unpacked)
  • Files: 3,524 files (JS + TypeScript definitions)
  • Tree-shakeable: Yes - only imported icons are bundled
  • Peer Dependencies: React >= 16

Available Icons

View the complete list of icons:

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Contributing

We welcome contributions to enhance the project. Our current focus:

  • ✅ Bug fixes for existing icons
  • ✅ TypeScript improvements
  • ✅ Documentation updates
  • ❌ New icon contributions (not accepted at this time)

Credits

License

MIT © UI Astra

版本与发布记录

@astraicons/react 共发布 49 个版本,首次发布于 2024/06/13;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.7.0latest2025/12/3110 个月前
1.6.92025/12/3010 个月前
1.6.82025/12/2910 个月前
1.6.72025/12/2610 个月前
1.6.62025/12/0810 个月前
1.6.52025/12/0711 个月前

关于 @astraicons/react 的常见问题

@astraicons/react 是什么?

A comprehensive icon set designed for websites, applications, social networks, and print media, tailored specifically for UI Astra.

如何安装 @astraicons/react?

在项目目录运行 npm install @astraicons/react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>= 16)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@astraicons/react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@astraicons/react 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@astraicons/react 可以商用吗?

@astraicons/react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@astraicons/react 的下载量有多少?

根据 npm 官方下载统计,@astraicons/react 在 2026/10/07 – 2026/11/05 这 30 天内被下载 8,539 次,日均约 285 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@astraicons/react 还在维护吗?

最新版本 1.7.0 发布于 2025/12/31(10 个月前);至今共发布 49 个版本,其中过去 12 个月发布了 12 个;首次发布于 2024/06/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。