@als-tp/als-react-ts-ui

中文文档
0.20.6发布于 2026/11/03MITTypeScriptESM + CJS近 30 天下载 2118

A comprehensive React TypeScript UI component library built with Base UI by ALSInnovation

原始使用文档
文档目录25 节
  1. Features
  2. Installation
  3. Peer Dependencies
  4. Usage
  5. Import Styles
  6. Import Components
  7. TypeScript Support
  8. Available Components
  9. Form Components
  10. Layout Components
  11. Overlay Components
  12. Feedback Components
  13. Content Components
  14. Interactive Components
  15. Customization
  16. Global Theme Override
  17. Scoped Theme Override
  18. Recommended Tokens To Override First
  19. Notes
  20. Development
  21. Building the Library
  22. Running Storybook
  23. Running Tests
  24. License
  25. Links

@als-tp/als-react-ts-ui

A comprehensive React TypeScript UI component library built on top of Base UI, providing 50+ accessible, customizable components with full TypeScript support, including AI and layout primitives.

Features

  • 🎨 50+ Components: UI, AI, Strapi, and layout components
  • 💪 TypeScript First: Full type safety and IntelliSense support
  • ♿ Accessible: Built on Base UI with ARIA compliance
  • 🎭 Customizable: CSS Modules with CSS variables for theming
  • 📦 Tree-shakeable: Import only what you need
  • 🔧 Modern Stack: React 19, TypeScript 6, Vite 8

Installation

# npm
npm install @als-tp/als-react-ts-ui

# pnpm
pnpm add @als-tp/als-react-ts-ui

# yarn
yarn add @als-tp/als-react-ts-ui

Peer Dependencies

This library requires the following peer dependencies:

pnpm install react react-dom @base-ui/react@^1.4.0

Usage

Import Styles

First, import the CSS tokens and the style domains you need in your application entry point:

import '@als-tp/als-react-ts-ui/styles/tokens';
import '@als-tp/als-react-ts-ui/styles/components';

If you need the full stylesheet instead of domain splitting:

import '@als-tp/als-react-ts-ui/styles';

Import Components

import { ALSButton, ALSDialog, ALSInput } from '@als-tp/als-react-ts-ui';

function App() {
  return (
    <div>
      <ALSButton variant="primary" size="md">
        Click me
      </ALSButton>
      
      <ALSInput placeholder="Enter text..." />
    </div>
  );
}

TypeScript Support

All components are fully typed. TypeScript will provide autocomplete and type checking:

import type { ALSButtonProps } from '@als-tp/als-react-ts-ui';

const buttonProps: ALSButtonProps = {
  variant: 'primary',
  size: 'lg',
  onClick: () => console.log('clicked')
};

Available Components

Form Components

  • ALSButton - Versatile button with variants and sizes
  • ALSInput - Text input field
  • ALSCheckbox - Checkbox with label
  • ALSCheckboxGroup - Group of checkboxes
  • ALSRadio - Radio button
  • ALSSwitch - Toggle switch
  • ALSSelect - Dropdown select
  • ALSCombobox - Autocomplete combobox
  • ALSAutocomplete - Autocomplete input
  • ALSNumberField - Numeric input
  • ALSSlider - Range slider
  • ALSField - Form field wrapper
  • ALSFieldset - Form fieldset
  • ALSForm - Form container

Layout Components

  • MainLayout - Main application layout
  • ALSSeparator - Visual separator
  • ALSScrollArea - Scrollable container
  • ALSTabs - Tab navigation
  • ALSToolbar - Toolbar container

Overlay Components

  • ALSDialog - Modal dialog
  • ALSAlertDialog - Alert/confirmation dialog
  • ALSPopover - Popover overlay
  • ALSTooltip - Tooltip
  • ALSMenu - Dropdown menu
  • ALSContextMenu - Context menu
  • ALSMenubar - Menu bar
  • ALSNavigationMenu - Navigation menu

Feedback Components

  • ALSToast - Toast notifications
  • ALSProgress - Progress indicator
  • ALSMeter - Meter/gauge

Content Components

  • ALSAccordion - Expandable accordion
  • ALSCollapsible - Collapsible content
  • ALSAvatar - User avatar
  • ALSPreviewCard - Preview card

Interactive Components

  • ALSToggle - Toggle button
  • ALSToggleGroup - Toggle button group

Customization

The library uses --als-* CSS variables for theming.

Import the library tokens first, then the style domains you use, and finally your theme overrides:

import '@als-tp/als-react-ts-ui/styles/tokens';
import '@als-tp/als-react-ts-ui/styles/components';
import './als-theme.css';

Available style entrypoints:

  • @als-tp/als-react-ts-ui/styles for the full CSS bundle
  • @als-tp/als-react-ts-ui/styles/tokens for public CSS variables and font declarations only
  • @als-tp/als-react-ts-ui/styles/components for core components and Strapi styles
  • @als-tp/als-react-ts-ui/styles/ai for AI component styles
  • @als-tp/als-react-ts-ui/styles/layout for layout styles

For this repository's local demo and Storybook shell, the global demo bootstrap lives in src/styles/init.css. Package consumers should import the package style entrypoints above instead of referencing that file directly.

Global Theme Override

Use :root if you want the whole application to use your theme:

:root {
    --als-color-brand: #d92d20;
    --als-color-brand-strong: #b42318;
    --als-color-brand-subtle: #fee4e2;

    --als-color-accent: #f97316;
    --als-color-accent-strong: #c2410c;

    --als-color-border-focus: var(--als-color-brand);

    --als-color-text-primary: #1f2937;
    --als-color-text-secondary: #667085;

    --als-color-surface-page: #f8fafc;
    --als-color-surface-default: #ffffff;
    --als-color-surface-subtle: #f1f5f9;

    --als-font-family-base: "Inter", system-ui, sans-serif;
    --als-font-size-base: 1rem;
    --als-radius-md: 0.75rem;
}

Scoped Theme Override

Use a wrapper class if you only want part of the app to use a custom theme:

.als-theme-acme {
    --als-color-brand: #0f766e;
    --als-color-brand-strong: #115e59;
    --als-color-brand-subtle: #ccfbf1;
}
<div className="als-theme-acme">
  <ALSButton variant="primary">Save</ALSButton>
</div>
  • Brand: --als-color-brand, --als-color-brand-strong, --als-color-brand-subtle
  • Text: --als-color-text-primary, --als-color-text-secondary
  • Surfaces: --als-color-surface-page, --als-color-surface-default, --als-color-surface-subtle
  • Borders and focus: --als-color-border-default, --als-color-border-subtle, --als-color-border-focus
  • Typography: --als-font-family-base, --als-font-size-base
  • Shape and spacing: --als-radius-*, --als-space-*

Notes

  • For new integrations, prefer the --als-* tokens instead of the old legacy variable names.
  • Most components use semantic tokens such as --als-color-brand instead of raw palette values, so changing these top-level tokens is usually enough to rebrand the library.
  • If you need the full list of available tokens, see src/styles/tokens.css.

Development

Building the Library

pnpm run build:lib

Running Storybook

pnpm storybook

Running Tests

pnpm test

License

MIT © ALS TP

版本与发布记录

@als-tp/als-react-ts-ui 共发布 55 个版本,首次发布于 2025/12/01;过去 12 个月发布了 55 个版本。

版本发布日期距今
0.20.6latest2026/11/034 天前
0.20.42026/11/034 天前
0.20.32026/10/299 天前
0.20.22026/10/2612 天前
0.20.12026/10/2612 天前
0.20.02026/10/2612 天前

关于 @als-tp/als-react-ts-ui 的常见问题

@als-tp/als-react-ts-ui 是什么?

A comprehensive React TypeScript UI component library built with Base UI by ALSInnovation

如何安装 @als-tp/als-react-ts-ui?

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

@als-tp/als-react-ts-ui 支持 TypeScript 吗?

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

@als-tp/als-react-ts-ui 支持 ESM 还是 CommonJS?

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

@als-tp/als-react-ts-ui 可以商用吗?

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

@als-tp/als-react-ts-ui 的下载量有多少?

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

@als-tp/als-react-ts-ui 还在维护吗?

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