@canva/app-ui-kit

中文文档
5.15.0发布于 2026/10/07SEE LICENSE IN LICENSE.mdTypeScriptESM + CJS近 30 天下载 10.9万

The Canva Developers SDK UI components library for apps inside Canva

原始使用文档
文档目录13 节
  1. Table of contents
  2. Introduction
  3. Features
  4. Installation
  5. Usage
  6. Components and Icons
  7. Design tokens
  8. CSS variables
  9. JavaScript variables
  10. List of design tokens
  11. Changelog
  12. Contributing
  13. License

@canva/app-ui-kit

React-based component library for creating Canva Apps that mimic the look and feel of Canva.

Table of contents

Introduction

The App UI Kit is a React-based component library for designing and developing Canva Apps that mimic the look and feel of Canva.

To learn more about developing apps on Canva, see: Canva dev
To browse all components in the App UI Kit, see: Canva dev

Note: If you're planning on releasing a Canva App to the public, we strongly recommend using the App UI Kit, as we expect apps to meet certain design standards and it's difficult to do so without the components.

Features

  • Based on the components used by Canva's own engineers.
  • Built for accessibility, usability, and cross-platform compatibility.
  • Includes design tokens for creating custom components.

Installation

npm install @canva/app-ui-kit

Usage

Note: If you're using the starter kit, these steps have already been done for you.

At the root of the application, such as in the index.tsx file:

  1. Import the stylesheet:

    import '@canva/app-ui-kit/styles.css';
    
  2. Import the AppUiProvider component:

    import { AppUiProvider } from '@canva/app-ui-kit';
    
  3. Wrap the app in the AppUiProvider component:

    <AppUiProvider>
      <App />
    </AppUiProvider>
    

    This component should only be used once in an app's component tree.

After completing these steps, import and use components from the @canva/app-ui-kit package:

import { Button, Rows, Text, Title } from '@canva/app-ui-kit';
import * as React from 'react';

export function App() {
  return (
    <Rows spacing="2u">
      <Rows spacing="1u">
        <Title>Hello world</Title>
        <Text>This is a paragraph of text.</Text>
      </Rows>
      <Button variant="primary">Click me</Button>
    </Rows>
  );
}

The components must exist as descendants of the AppUiProvider component.

Components and Icons

The App UI Kit exports a number of Components (e.g. Button, Text, Rows, etc. ) and Icons (e.g. PlusIcon, SearchIcon, etc.) to use in your apps.

For the complete list and documentation on all components and icons see our Storybook instance:

Design tokens

A design token is a variable used to store design-related values such as colors. They act as a single source of truth for design properties, making it easier to keep UIs consistent and maintainable.

The App UI Kit exposes design tokens as JavaScript and CSS variables. Apps can use these tokens to create or customize components that match the look and feel of Canva. If Canva changes the token's values, those changes are automatically reflected in the app.

CSS variables

You can use the CSS variables in global stylesheets, CSS modules, or the app's source code:

.button {
  background-color: var(--ui-kit-color-primary);
}

The variables are written in kebab case and are prefixed with --ui-kit-.

JavaScript variables

You can use the JavaScript variables in the app's source code:

import { tokens } from '@canva/app-ui-kit';

function App() {
  return <div style={{ backgroundColor: tokens.colorPrimary }}>Hello world.</div>;
}

The variables are written in camel case, without a prefix.

List of design tokens

You can find the reference documentation for design tokens on the Canva Developers documentation site:

Changelog

See the CHANGELOG.md file or view it on our documentation site.

Contributing

We're actively developing this package but are not currently accepting third-party contributions. If you'd like to request any changes or additions to the package, submit a feature request via the Canva Developers Community.

License

See the LICENSE.md file.

版本与发布记录

@canva/app-ui-kit 共发布 55 个版本,首次发布于 2023/06/08;过去 12 个月发布了 19 个版本。

版本发布日期距今
5.15.0latest2026/10/071 个月前
5.14.32026/09/032 个月前
5.14.22026/09/022 个月前
5.14.12026/08/272 个月前
5.14.02026/07/293 个月前
5.13.02026/07/153 个月前

其他发布通道:beta → 6.0.0-beta.1。

关于 @canva/app-ui-kit 的常见问题

@canva/app-ui-kit 是什么?

The Canva Developers SDK UI components library for apps inside Canva

如何安装 @canva/app-ui-kit?

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

@canva/app-ui-kit 支持 TypeScript 吗?

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

@canva/app-ui-kit 支持 ESM 还是 CommonJS?

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

@canva/app-ui-kit 可以商用吗?

@canva/app-ui-kit 使用 SEE LICENSE IN LICENSE.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@canva/app-ui-kit 的下载量有多少?

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

@canva/app-ui-kit 还在维护吗?

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