@chakra-ui/pro-theme

中文文档
0.10.0发布于 2023/07/13MITTypeScriptESM + CJS近 30 天下载 7.5万

The Chakra UI Pro Theme extends the base Chakra UI theme by introducing additional component variants, sizes, and a collection of semantic tokens and text layer styles. Made to fit perfectly with the original Chakra UI theme, the Pro Theme makes your user

原始使用文档
文档目录5 节
  1. Installation
  2. Setting up the Pro Theme
  3. Font Configuration
  4. Using a Different Font
  5. Generating Theme Typings

Welcome to Chakra UI Pro Theme

The Chakra UI Pro Theme extends the base Chakra UI theme by introducing additional component variants, sizes, and a collection of semantic tokens and text layer styles. Made to fit perfectly with the original Chakra UI theme, the Pro Theme makes your user interface look even better, and it won't mess up your current setup. Just a heads up though - if your custom variants have the same names as ours, you might see a few changes. For the best experience with the Pro Theme, you might want to check out our comparison here.

Installation

Ensure Chakra UI is installed in your project. If not, you can follow the installation guide on Chakra UI's website. To install Chakra UI Pro Theme, you can use yarn:

yarn add install @chakra-ui/pro-theme

Alternatively, if you prefer using npm:

npm install @chakra-ui/pro-theme

Setting up the Pro Theme

Setting up the Pro Theme is a straightforward process. The Pro Theme extends the base theme from Chakra UI and can be incorporated in a few simple steps. Import the Pro Theme and the base theme from Chakra UI:

import { theme as proTheme } from '@chakra-ui/pro-theme'
import { extendTheme, theme as baseTheme } from '@chakra-ui/react'

Next, extend the base theme with our Pro Theme:

export const theme = extendTheme(
  {
    colors: { ...baseTheme.colors, brand: baseTheme.colors.blue },
  },
  proTheme,
)

This code snippet imports the Pro Theme and the base theme from Chakra UI. It then uses the extendTheme function from Chakra UI to merge the Pro Theme with your custom configuration.

Font Configuration

Chakra UI Pro Theme uses Spline Sans as heading font family and Open Sans as body font family by default. To include this, first, you need to install the font:

yarn add @fontsource-variable/spline-sans @fontsource-variable/open-sans

Then, you can import it in your theme setup:

import '@fontsource-variable/open-sans'
import '@fontsource-variable/spline-sans'

Note: Depending on the platform/framework, the best way to install fonts may differ.

Using a Different Font

To use a different font, such as Inter, you first need to install the font:

yarn add @fontsource-variable/inter

Then, import the font and adjust the fonts key in your theme configuration:

import { theme as proTheme } from '@chakra-ui/pro-theme'
import { extendTheme, theme as baseTheme } from '@chakra-ui/react'
import '@fontsource-variable/inter'

export const theme = extendTheme(
  {
    colors: { ...baseTheme.colors, brand: baseTheme.colors.blue },
    fonts: {
      heading: "'Inter Variable', -apple-system, system-ui, sans-serif",
      body: "'Inter Variable', -apple-system, system-ui, sans-serif",
    },
  },
  proTheme,
)

Generating Theme Typings

With Chakra UI Pro Theme, you can enhance your development experience by generating theme typings. This makes the theme tokens used in the Pro Theme available to your IDE's intellisense, aiding in faster and more accurate development.

To generate the theme typings, follow these steps:

First, install the Chakra CLI as a dev dependency:

yarn add --dev @chakra-ui/cli

Next, generate the theme typings using the following command. Replace './path-to-theme.ts' with the actual path to your theme file:

yarn chakra-cli tokens ./path-to-theme.ts

Once this is completed, you may need to "Restart the TS Server" in VSCode to see the changes.

For further information about the Chakra CLI and theme typings, check out the Chakra CLI documentation.

版本与发布记录

@chakra-ui/pro-theme 共发布 83 个版本,首次发布于 2022/02/10;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.10.0latest2023/07/133 年前
0.9.02023/06/303 年前
0.8.02023/06/303 年前
0.7.12023/06/293 年前
0.7.02023/06/293 年前
0.6.02023/06/293 年前

其他发布通道:beta → 0.6.0-beta.0。

关于 @chakra-ui/pro-theme 的常见问题

@chakra-ui/pro-theme 是什么?

The Chakra UI Pro Theme extends the base Chakra UI theme by introducing additional component variants, sizes, and a collection of semantic tokens and text layer styles. Made to fit perfectly with the original Chakra UI theme, the Pro Theme makes your user

如何安装 @chakra-ui/pro-theme?

在项目目录运行 npm install @chakra-ui/pro-theme,或使用 pnpm add / yarn add / bun add。

@chakra-ui/pro-theme 支持 TypeScript 吗?

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

@chakra-ui/pro-theme 支持 ESM 还是 CommonJS?

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

@chakra-ui/pro-theme 可以商用吗?

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

@chakra-ui/pro-theme 的下载量有多少?

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

@chakra-ui/pro-theme 还在维护吗?

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