@base-org/account-ui

中文文档
1.0.1发布于 2025/07/17Apache-2.0TypeScriptES Module零依赖近 30 天下载 5131

Base Account UI Components

原始使用文档
文档目录12 节
  1. Features
  2. Installation
  3. Framework-Specific Documentation
  4. Quick Start - React
  5. SignInWithBaseButton
  6. BasePayButton
  7. Props
  8. SignInWithBaseButton
  9. BasePayButton
  10. Development
  11. Build Commands
  12. Architecture

Base Account SDK UI Components

This package provides UI components for React, Preact, Vue, and Svelte applications.

Features

  • 🎯 Multi-framework support: React, Preact, Vue, and Svelte components
  • 🛠️ TypeScript support: Full type safety for all frameworks
  • 📦 Single package: Import from one package, use with any framework
  • 🎨 Consistent API: Same props interface across frameworks

Installation

npm install @base-org/account-ui

Framework-Specific Documentation

For detailed usage examples and setup instructions for each framework:

  • React - React-specific documentation and examples
  • Preact - Preact-specific documentation and examples
  • Vue - Vue-specific documentation and examples
  • Svelte - Svelte-specific documentation and examples

Quick Start - React

SignInWithBaseButton

import { SignInWithBaseButton } from '@base-org/account-ui/react';

function App() {
  return (
    <SignInWithBaseButton 
      onClick={() => console.log('Sign in clicked!')}
      align="center"
      variant="solid"
      colorScheme="light"
    />
  );
}

BasePayButton

import { BasePayButton } from '@base-org/account-ui/react';

function App() {
  return (
    <BasePayButton 
      onClick={() => console.log('Pay with Base clicked!')}
      colorScheme="light"
    />
  );
}

Props

SignInWithBaseButton

PropTypeDefaultDescription
align'left' | 'center''center'Button alignment
variant'solid' | 'transparent''solid'Button style variant
colorScheme'light' | 'dark' | 'system''system'Color theme
onClick() => voidundefinedClick handler

BasePayButton

PropTypeDefaultDescription
colorScheme'light' | 'dark' | 'system''system'Color theme
onClick() => voidundefinedClick handler

Development

Build Commands

# Build all frameworks
npm run build

# TypeScript checking
npm run typecheck

# Run tests
npm run test

# Lint
npm run lint

Architecture

This package provides:

  • Framework-specific exports: /react, /preact, /vue, /svelte
  • Shared component logic: Preact components as the base implementation
  • Framework wrappers: React, Vue, and Svelte components that mount Preact components
  • Type definitions: Full TypeScript support for all frameworks

版本与发布记录

@base-org/account-ui 共发布 3 个版本,首次发布于 2025/07/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2025/07/171.3 年前
1.0.02025/07/171.3 年前
0.0.0placeholder2025/07/161.3 年前

关于 @base-org/account-ui 的常见问题

@base-org/account-ui 是什么?

Base Account UI Components

如何安装 @base-org/account-ui?

在项目目录运行 npm install @base-org/account-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:clsx(*)、preact(*)、@base-org/account(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@base-org/account-ui 支持 TypeScript 吗?

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

@base-org/account-ui 支持 ESM 还是 CommonJS?

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

@base-org/account-ui 可以商用吗?

@base-org/account-ui 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@base-org/account-ui 的下载量有多少?

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

@base-org/account-ui 还在维护吗?

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