@gravity-ui/illustrations

中文文档
3.0.0发布于 2026/11/05MITTypeScript零依赖近 30 天下载 2.9万

Pack of Gravity UI illustrations

原始使用文档
文档目录11 节
  1. Installation
  2. Usage
  3. React
  4. SVG
  5. Development
  6. License
  7. For AI agents
  8. When to use
  9. When not to use
  10. Common pitfalls
  11. Documentation for AI agents

@gravity-ui/illustrations · npm package CI storybook

Installation

npm install --save-dev @gravity-ui/illustrations

Usage

React

Preparation

Setup illustrations theme. Execute any of the following steps:

Defining css-tokens with own colors pallete

Define following css-tokens in app:

--gil-color-object-base: rgb(255, 190, 92);
--gil-color-object-accent-heavy: rgb(211, 101, 7);
--gil-color-object-hightlight: rgb(255, 216, 157);
--gil-color-shadow-over-object: rgb(211, 158, 80);
--gil-color-background-lines: rgb(140, 140, 140);
--gil-color-background-shapes: rgb(242, 242, 242);
--gil-color-object-accent-light: rgb(255, 255, 255);
--gil-color-object-danger: rgb(255, 0, 61);
Using mixins with default gravity-theme in scss

Use the following mixins for styling illustrations in different themes

@import '@gravity-ui/illustrations/styles/theme.scss';

.g-root {
  &_theme_light {
    @include g-illustrations-colors-light;
  }

  &_theme_light-hc {
    @include g-illustrations-colors-light-hc;
  }

  &_theme_dark {
    @include g-illustrations-colors-dark;
  }

  &_theme_dark-hc {
    @include g-illustrations-colors-dark-hc;
  }
}
Alternative for projects with pre-installed gravity theme

Alternatively, if @gravity-ui/uikit is already installed in the project and default theme is used, you can just import styles.scss to the root file with styles in your project:

// existing gravity styles definition
import '@gravity-ui/uikit/styles/styles.css';
// just add one more import below
import '@gravity-ui/illustrations/styles/styles.scss';

Components usage

import NotFound from '@gravity-ui/illustrations/NotFound';

or

import {NotFound} from '@gravity-ui/illustrations';

SVG

You might need an appropriate loader for this

import notFound from '@gravity-ui/illustrations/svgs/not-found-light.svg';

Development

For updating illustrations according to new design, change the content of svg-s in light theme (<this-repository-root>/svgs/<illustration-name>-light.svg files) and then run command:

npm run generate

License

Distributed under the MIT License. See LICENSE for details.

For AI agents

A themed set of flat SVG illustrations (empty states, errors, not-found, etc.) for Gravity UI apps — reach for it when you need ready-made, theme-aware placeholder/empty-state artwork instead of drawing your own or using bare icons.

When to use

  • Empty states, 404/error pages, or onboarding placeholders that need a consistent illustration, not a functional UI control.
  • Themeable artwork — the SVGs respond to Gravity theme tokens (light/dark, high-contrast) via SCSS mixins or CSS variables.
  • Importing artwork as React components (default) or as raw .svg files.

When not to use

  • For functional UI iconography (chevrons, checks, buttons), use @gravity-ui/icons — illustrations are decorative artwork, not UI glyphs.
  • For a single one-off illustration you already have as an asset, import that asset directly rather than pulling in this package.

Common pitfalls

  • Rendering without a theme import — illustrations appear uncolored unless you import @gravity-ui/illustrations/styles/styles.scss (or define the --gil-color-* CSS tokens).
  • Hallucinated default export names — illustration components are PascalCase named exports (e.g. NotFound), imported from the package root or per-file (@gravity-ui/illustrations/NotFound).
  • Importing .svg directly in a non-configured bundler — raw SVG imports need an appropriate loader; prefer the React component export to avoid bundler setup.

Documentation for AI agents

Agent-readable documentation for the installed version is located in node_modules/@gravity-ui/illustrations/docs/INDEX.md.

版本与发布记录

@gravity-ui/illustrations 共发布 5 个版本,首次发布于 2024/03/27;过去 12 个月发布了 2 个版本。

版本发布日期距今
3.0.0latest2026/11/0511 天前
2.1.12026/04/216 个月前
2.1.02025/02/281.7 年前
2.0.02025/02/051.8 年前
1.0.02024/03/272 年前

关于 @gravity-ui/illustrations 的常见问题

@gravity-ui/illustrations 是什么?

Pack of Gravity UI illustrations

如何安装 @gravity-ui/illustrations?

在项目目录运行 npm install @gravity-ui/illustrations,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)、react-dom(^18.0.0 || ^19.0.0)、@gravity-ui/uikit(^8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gravity-ui/illustrations 支持 TypeScript 吗?

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

@gravity-ui/illustrations 可以商用吗?

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

@gravity-ui/illustrations 的下载量有多少?

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

@gravity-ui/illustrations 还在维护吗?

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