JGuang / JGuang UI

Manual Installation

本页提供 JGuang UI 技术内容、中文导航与术语适配。

中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。

Add Tailwind CSS

Components are styled using Tailwind CSS. You need to install Tailwind CSS in your project.

Follow the Tailwind CSS installation instructions to get started.

Add dependencies

Add the following dependencies to your project:

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

Configure import aliases

Choose one of the following alias setups.

Option A: ,[object Object], paths

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"]
    }
  }
}

Option B: ,[object Object]

{
  "imports": {
    "#components/*": "./src/components/*.tsx",
    "#lib/*": "./src/lib/*.ts",
    "#hooks/*": "./src/hooks/*.ts"
  }
}
{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "resolvePackageJsonImports": true
  }
}

The @ alias is a preference. You can use other aliases if you want. If you use package.json#imports, keep the matching alias roots in components.json. See the

package imports guide

for framework-specific setup.

Configure styles

Add the following to your styles/globals.css file. You can learn more about using CSS variables for theming in the theming section.

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

Add a cn helper

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

Create a ,[object Object], file

Create a components.json file in the root of your project.

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

If you're using package.json#imports, use the corresponding #... aliases instead:

{
  "aliases": {
    "components": "#components",
    "utils": "#lib/utils",
    "ui": "#components/ui",
    "lib": "#lib",
    "hooks": "#hooks"
  }
}

That's it

You can now start adding components to your project.

来源: installation/manual.mdx

JGuang UI 技术文档。

On this page