@genexus/chameleon-controls-library

中文文档
6.38.0发布于 2026/10/14MITTypeScriptES Module近 30 天下载 2156

chameleon - A library of white-label, highly-customizable and reusable web components

原始使用文档
文档目录12 节
  1. Using this library
  2. In frameworks (React, Angular, etc) using a design system l…
  3. In a Stencil project
  4. Node Modules
  5. Script tag
  6. Accessibility checker
  7. Meaning of development status in each control
  8. Local Development
  9. Running the tests
  10. Building for production
  11. Trademarks
  12. License
genexuslabs@main
CI

Netlify Status Built With Stencil code style: prettier

Chameleon

A library of white-label, highly-customizable and reusable web components.

Visit the Chameleon Showcase for general information, demos and documentation.

Using this library

There are four strategies we recommend for using these web components.

In frameworks (React, Angular, etc) using a design system like Mercury or Unanimo.

For this, we recommend consulting our repository chameleon-integrations that contains various examples demonstrating how to effectively use the Chameleon Controls Library in different frameworks and with different design systems.

React

  • Run

    npm i @genexus/chameleon-controls-library --save
    
  • Starting with Chameleon version 6.4.0, there is a CLI to create React Web Component wrappers. To create the wrappers, run the following command:

    npx chameleon-generate-react <output dir (optional)>
    

    For example:

    npx chameleon-generate-react ./src/chameleon-components
    
  • Tip: We recommend adding this command to your package.json file before running the dev server and production builds, as it takes less than 300ms to execute.

    For example:

    "dev": "npm run build.chameleon && ...",
    "build": "npm run build.chameleon && ..."
    "build.chameleon": "chameleon-generate-react <output dir (optional)>"
    

    If you are in a monorepo environment, you may need run the script with npx chameleon-generate-react, yarn chameleon-generate-react, etc.

  • Finally, all you have to do is use the components in your project!

In a Stencil project

  • Run

    npm i @genexus/chameleon-controls-library --save
    
  • Add an import to the library inside src/index.ts:

    import "@genexus/chameleon-controls-library";
    
  • Then you can use the web components anywhere in your template, JSX, html etc.

Node Modules

  • Run

    npm i @genexus/chameleon-controls-library --save
    
  • Put a script tag similar to this <script src="node_modules/@genexus/chameleon-controls-library/dist/chameleon/chameleon.esm.js"></script> in the head of your index.html

  • Then you can use the web components anywhere in your template, JSX, html etc

Script tag

  • Put a script tag similar to this <script src="https://unpkg.com/@genexus/chameleon-controls-library@latest/dist/chameleon/chameleon.esm.js"></script> in the head of your index.html

  • Then you can use the web components anywhere in your template, JSX, html etc

Accessibility checker

Starting with Chameleon version 6.4.0 there is a new accessibility utility that checks if form elements have a valid label and notifies (console.warn) when they don't accomplish this condition. At this moment, it's supported in the following components:

  • ch-combo-box-render
  • ch-edit
  • ch-progress
  • ch-slider

The accessibility checker is enabled by default and can be disabled as follows:

import { disableAccessibilityReports } from "@genexus/chameleon-controls-library/dist/collection";

disableAccessibilityReports();

Meaning of development status in each control

CategoryDescription
"experimental"The control is in its early stages of the development. This phase is often useful for testing the control early, but it is very likely that the interface will change from the final version.

Breaking changes for the control can be applied in "patch" tags.
"developer-preview"The control is in its final stages of the development. The interface and behaviors to implement the control are almost complete. The interface of the control should not change so much from the final version.

Breaking changes for the control can be applied in "patch" tags.
"stable"The control's development is stable and can be safety used in production environments.

Breaking changes for the control can be applied in "major" tags. In some cases, two "major" tags would be used to deprecate a behavior in the control.

Local Development

npm i
npm start

Running the tests

To run the unit tests for the custom elements, run:

npm test

To run the spec tests for a specific custom element, run:

npm run test.spec src/components/<path to test file.spec.ts>

## For example:

npm run test.spec src/components/layout-splitter/tests/fixAndUpdateLayoutModel.spec.ts

To watch changes for tests (spec and e2e), run:

npm run test.watch

To watch only one file, run:

npm run test.watch -- -- src/components/edit/<path to test file.<spec|e2e>.ts>

## For example:

npm run test.watch -- -- src/components/edit/tests/edit.e2e.ts

To watch only one folder, run:

npm run test.watch -- -- <folder path>

## For example:

npm run test.watch -- -- src/components/edit/tests/

Building for production

To build the design for production, run:

npm run build

Trademarks

This project may reference names, logos, and brands of third parties. All such references are for identification purposes only and do not imply any endorsement, sponsorship, or affiliation between GeneXus S.A. and the respective trademark owners.

  • GeneXus is a trademark or registered trademark of GeneXus S.A.
  • Chameleon, Mercury, and Unanimo are product names of GeneXus S.A.
  • React is a trademark of Meta Platforms, Inc.
  • Angular is a trademark of Google LLC.
  • Stencil is a trademark of Drifty Co. (Ionic).
  • Monaco Editor is a product of Microsoft Corporation.
  • npm is a trademark of npm, Inc.

All other trademarks, service marks, and product names mentioned in this project are the property of their respective owners.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for the full text.

Copyright 2024 GeneXus S.A.

版本与发布记录

@genexus/chameleon-controls-library 共发布 223 个版本,首次发布于 2023/05/16;过去 12 个月发布了 13 个版本。

版本发布日期距今
6.38.0latest2026/10/141 个月前
6.37.02026/08/123 个月前
6.36.12026/07/283 个月前
6.34.02026/03/287 个月前
6.33.12026/03/098 个月前
6.33.02026/03/078 个月前

关于 @genexus/chameleon-controls-library 的常见问题

@genexus/chameleon-controls-library 是什么?

chameleon - A library of white-label, highly-customizable and reusable web components

如何安装 @genexus/chameleon-controls-library?

在项目目录运行 npm install @genexus/chameleon-controls-library,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:lit(^3.3.2)、katex(>=0.18.2 <0.20.0)、@genexus/kasstor-webkit(^0.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 chameleon-generate-react,可以用 npx chameleon-generate-react 直接运行。

@genexus/chameleon-controls-library 支持 TypeScript 吗?

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

@genexus/chameleon-controls-library 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@genexus/chameleon-controls-library 可以商用吗?

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

@genexus/chameleon-controls-library 的下载量有多少?

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

@genexus/chameleon-controls-library 还在维护吗?

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