@ember-eui/core

中文文档
16.1.4发布于 2026/10/28MITTypeScriptCommonJS近 30 天下载 6409

Ember Components for Elastic UI

原始使用文档
文档目录6 节
  1. Icons
  2. Compatibility
  3. Installation
  4. Contributing
  5. PR's are truly welcome
  6. License

@ember-eui/core

This project aims to provide ember components implementing the css layer of https://elastic.github.io/eui

Icons

EUI icons work out of the box: they are bundled with the addon, no build configuration is needed (this used to require ember-svg-jar).

<EuiIcon @type="chevronSingleDown" />

Each EUI icon is its own chunk, loaded the first time it renders, so apps only download the icons they use. Until it arrives an empty icon of the same size takes its place; await render() / settled() in tests wait for it. Preload icons that should show up right away:

import { preloadIcons } from '@ember-eui/core/utils/preload-icons';

export default class ApplicationRoute extends Route {
  async beforeModel() {
    await preloadIcons(['chevronSingleDown', 'cross', 'magnify']);
  }
}

To use your own icons, add @svg-jar/plugin to your app's vite.config.mjs (svgJar({ target: 'ember' })) so svg files can be imported as components. Then either pass the component directly:

import MyLogo from '../icons/my-logo.svg';
<EuiIcon @type={{MyLogo}} />
<EuiBadge @iconType={{MyLogo}}>New</EuiBadge>

or register them by name, e.g. a whole folder at once with iconsFromGlob (icons are named after their file, like ember-svg-jar did):

// app/routes/application.js
import Route from '@ember/routing/route';
import { service } from '@ember/service';
import { iconsFromGlob } from '@ember-eui/core/utils/icons-from-glob';

export default class ApplicationRoute extends Route {
  @service euiConfig;

  beforeModel() {
    this.euiConfig.updateConfig({
      'euiIcon.icons': iconsFromGlob(
        import.meta.glob('../icons/**/*.svg', { eager: true })
      ),
    });
  }
}
<EuiIcon @type="my-logo" />
<EuiButton @iconType="rocket">Launch</EuiButton>

Keep these svgs out of public/: Vite does not want files from the public directory imported from JavaScript (it warns in development). Moving e.g. public/assets/*.svg to app/icons/ keeps the same names.

Any other string is rendered as an <img> with that URL.

Compatibility

  • Ember.js v7.1 or above
  • Ember CLI v7.1 or above
  • Node.js v20.19 or above

Installation

ember install @ember-eui/core

Contributing

See the Contributing guide for details.

PR's are truly welcome

License

This project is licensed under the MIT License, except for the parts derived from Elastic UI (EUI) (its component styles, icons, ported component logic and documentation examples), which remain Copyright Elasticsearch B.V. under the Elastic License 2.0 or the Server Side Public License, v 1. See NOTICE.md.

Ember EUI is a community project and is not affiliated with or endorsed by Elastic.

版本与发布记录

@ember-eui/core 共发布 393 个版本,首次发布于 2021/03/05;过去 12 个月发布了 28 个版本。

版本发布日期距今
16.1.4latest2026/10/2816 天前
16.1.32026/10/2816 天前
16.2.02026/10/2816 天前
16.1.22026/10/2420 天前
16.1.12026/10/2420 天前
16.1.02026/10/2123 天前

其他发布通道:1.6.5 → 1.6.5,1.6.7 → 1.6.7,2.0.1 → 2.0.1,3.1.1 → 3.1.2,1.6.8 → 1.6.8,1.6.9 → 1.6.9。

关于 @ember-eui/core 的常见问题

@ember-eui/core 是什么?

Ember Components for Elastic UI

如何安装 @ember-eui/core?

在项目目录运行 npm install @ember-eui/core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:moment(^2.29.3)、ember-source(>= 7.1.0)、@ember/string(^4.0.0)、ember-modifier(^4.1.0)、ember-focus-trap(^1.1.0)、ember-concurrency(^5.1.0)、@glimmer/component(^2.0.0)、ember-power-select(^9.0.2)、ember-basic-dropdown(^9.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ember-eui/core 支持 TypeScript 吗?

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

@ember-eui/core 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@ember-eui/core 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 20.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ember-eui/core 可以商用吗?

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

@ember-eui/core 的下载量有多少?

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

@ember-eui/core 还在维护吗?

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