Installation
Requirements
- DevEco Studio 5.0+ (HarmonyOS NEXT SDK, compatibleSdkVersion 5.0.0(12))
- Build-time toolchain: Node.js >= 20 + pnpm (used only for token linking and the docs site, never enters the runtime)
Via ohpm
bash
ohpm install @lhgb/lh-ui-harmonyjson5
// oh-package.json5
{
"dependencies": {
"@lhgb/lh-ui-harmony": "^0.1.0"
}
}Source integration (local development)
Under the family layout, reference this repo's module directly (just open the lh-ui-harmony project in DevEco):
lh-ui-harmony/
├── lib/ # library module (@lhgb/lh-ui-harmony)
│ ├── common/theme/ # LhTheme (AppStorage injection)
│ ├── components/ # components (button / input / dialog…)
│ └── tokens/ # generated artifacts (see below)
└── entry/ # demo app (all variants + light/dark toggle)Syncing tokens
Tokens are generated artifacts and must be synced from lh-ui-core (the single source of truth — hand-editing is forbidden):
bash
cd ../lh-ui-core && pnpm codegen # generates the dist/harmony token artifacts
cd ../lh-ui-harmony
pnpm install # installs the build-time toolchain
pnpm link:tokens # syncs tokens into lib/tokens/pnpm link:tokens carries a three-level existence guard: local ../lh-ui-core/dist/harmony → the npm @lh-ui/core artifact → error.
Verifying the installation
bash
# After opening the project in DevEco Studio:
# Build → Build Hs/Hap (compile)
# Right-click tests → Run Tests (hypium golden cases)
