> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# lynx-ui 正式发布

[← 所有文章](/next/zh/blog/)

2026年5月22日

![方舟](https://github.com/fzx2666-fz.png)方舟工程师 @ Lynx![王洋](https://github.com/f0rdream.png)王洋工程师 @ Lynx![罗昶安](https://github.com/AdrianLCA.png)罗昶安工程师 @ Lynx![夏梦非](https://github.com/MoonfaceX.png)夏梦非组件主管 @ Lynx![杜光瑜](https://github.com/Dugyu.png)杜光瑜设计工程 @ Lynx![黄玄](https://github.com/huxpro.png)黄玄架构师 @ Lynx

[lynx-ui](https://github.com/lynx-family/lynx-ui) 在去年 12 月的 [React Advanced London](https://reactadvanced.com/) 上首次亮相并开源。几个月来，我们一直在打磨组件、完善文档、丰富示例。今天，lynx-ui 正式发布。



lynx-ui 组件一览

## 原生基础，Web 速度

[内置元素](/next/zh/guide/ui/elements-components.md#内置元件)和 [XElement](/next/zh/guide/ui/elements-components.md#xelement) 为 Lynx 提供了至关重要的底层能力：流畅滚动、精准手势、[原生渲染](/next/zh/guide/ui/elements-components.md#元件的背后原生渲染)。但产品不是仅靠原子就能构建的，这正是[组件](/next/zh/guide/ui/elements-components.md#组件将元件进行组合)的意义所在。Lynx 采用分层架构：原生层提供底层基础能力，Web 前端技术栈则在其上负责组件组合、状态管理、样式系统与产品特定行为的扩展。

lynx-ui 落地了这一分层思路：**保留原生用户体验，提供 Web 级别的开发速度。**


**下面是一个示例: lynx-ui-scroll-view**

**Bundle:** `dist/ScrollViewBasic.lynx.bundle` | Web: `dist/ScrollViewBasic.web.bundle`

```tsx {17-28}
// Copyright 2026 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.

import { root } from '@lynx-js/react'

import { ScrollView } from '@lynx-js/lynx-ui'

import { CircleCard } from '../shared/CircleCard'
import './index.css'

const LETTERS = ['L', 'Y', 'N', 'X', 'U', 'I', 'L', 'Y', 'N', 'X', 'J', 'S']

function App() {
  return (
    <view className='demo-container lunaris-dark'>
      <ScrollView scrollOrientation='horizontal' className='scroll-view'>
        <view className='scroll-view-content'>
          {LETTERS.map((letter, i) => (
            <CircleCard
              letter={letter}
              title='ScrollView'
              subtitle='@lynx-js/lynx-ui'
              key={`circle-${i}`}
            />
          ))}
        </view>
      </ScrollView>
    </view>
  )
}

root.render(<App />)

export default App

```




lynx-ui 的 [<code>ScrollView</code>](/next/zh/ui/components/scroll-view.md) 基于原生 [
<code>\<scroll-view></code>](/next/zh/api/elements/built-in/scroll-view.md) 原语构建

## 可组合的原语（Primitive）

当一个组件把所有东西都封在里面，每来一个新需求就要加一个 prop，最终会变成谁也不敢动的黑盒。lynx-ui 是一个 [unstyled](/next/zh/ui/styling-theming.md) 组件库。每个组件是一个 **primitive**，负责行为和状态，但不附带任何视觉样式。一个 primitive 由多个 **part** 组成，每个 part 独立渲染、独立样式化。

[`Popover`](/next/zh/ui/components/popover.md) 展示了这个思路。它不是一个不透明的单体组件，而是由各司其职的 part 组合而成：`PopoverRoot` 管理状态，`PopoverTrigger` 定义意图，`PopoverPositioner` 处理定位，`PopoverContent` 保持结构独立。


**下面是一个示例: lynx-ui-popover**

**Bundle:** `dist/PopoverBasic.lynx.bundle` | Web: `dist/PopoverBasic.web.bundle`

```tsx {20-38}
// Copyright 2026 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.

import { root } from '@lynx-js/react'

import {
  PopoverContent,
  PopoverPositioner,
  PopoverRoot,
  PopoverTrigger,
} from '@lynx-js/lynx-ui'

import { EllipsisIcon, OptionsMenu } from '../shared/index.js'
import './index.css'

function App() {
  return (
    <view className='demo-container lunaris-dark'>
      <PopoverRoot
        defaultShow={true}
        onClose={() => console.info('dismissed!')}
        onOpen={() => console.info('shown!')}
      >
        <PopoverTrigger className='popover-trigger'>
          <EllipsisIcon />
          <PopoverPositioner
            placement='bottom'
            placementOffset={12}
            autoAdjust='shift'
            className='popover-positioner'
          >
            <PopoverContent className='popover-content'>
              <OptionsMenu />
            </PopoverContent>
          </PopoverPositioner>
        </PopoverTrigger>
      </PopoverRoot>
    </view>
  )
}

root.render(<App />)

export default App

```




Composition is all you need.

正因为 primitive 是 unstyled 的，同样的可组合模型也为设计系统奠定了基础。你可以通过[样式与主题](/next/zh/ui/styling-theming.md)机制定义自己的主题，也可以按照 [shadcn/ui](https://ui.shadcn.com/) 的模式在 primitive 之上组合出带主题的 wrapper。

### LUNA

[LUNA](/next/zh/ui/luna-themes-tokens.md) 是我们在此基础上构建的参考设计语言。

LUNA 从 Lynx 标志性的渐变色出发，将品牌表达调适为更柔和的 UI 色调：温暖的粉红和玫瑰色渐变至薰衣草和水蓝色。在 LUNA 中，渐变作为一等视觉材质，用于表达形态和运动，赋予组件一种流动介质的质感。这种细腻也延伸到了 token 命名：LUNA 描述的是表面的感受，而非其位置——`ambient` 融入背景，`faint` 处于感知的阈值，`veil` 和 `film` 创造柔和的半透明层。



L.U.N.A Studio

## 可编程的交互

手势驱动的组件对两件事要求很高：行为要可定制，响应要低延迟。滑动、拖拽、轻扫，每一帧都在被用户感知。反馈一旦跟不上手势，体验就不再是原生的。

Lynx 采用[双线程模型](/next/zh/blog/lynx-unlock-native-for-more.md#让主线程专责服务于交互体验)，JavaScript 默认跑在后台线程，主线程专注渲染。需要时，[主线程脚本](/next/zh/react/main-thread-script.md)可以把交互逻辑搬到主线程，逐帧行为因此完全可编程。[`Swiper`](/next/zh/ui/components/swiper.md) 就是一个例子：拖拽时卡片逐帧跟手，不会事后追赶。


**下面是一个示例: lynx-ui-swiper**

**Bundle:** `dist/SwiperCustomTinder.lynx.bundle` | Web: `dist/SwiperCustomTinder.web.bundle`

```tsx {22-36}
// Copyright 2026 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.

import { root } from '@lynx-js/react'

import {
  Swiper,
  SwiperItem,
  interpolate,
  interpolateJS,
} from '@lynx-js/lynx-ui'

import { Card } from './Card'

import './styles.css'

const itemArr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const ITEM_WIDTH = 220
const ITEM_HEIGHT = 330

const customAnimation = (value: number) => {
  'main thread'
  const translateX = interpolate(value, [-1, 0], [-ITEM_WIDTH, 0], 'clamp')
  const translateY = interpolate(value, [0, 1], [0, -18], 'extend')
  const rotate = interpolate(value, [-1, 0], [-15, 0], 'clamp')
  const scale = interpolate(value, [0, 1], [1, 0.95], 'extend')
  const opacity = interpolate(value, [-1, -0.8, 0, 1], [0, 0.9, 1, 1], 'clamp')

  return {
    transform:
      `translate(${translateX}px, ${translateY}px) rotateZ(${rotate}deg) scale(${scale})`,
    opacity: opacity,
    'transform-origin': 'center',
  }
}

const customAnimationFirstScreen = (value: number, _index: number) => {
  const translateX = interpolateJS(value, [-1, 0], [-ITEM_WIDTH, 0], 'clamp')
  const translateY = interpolateJS(value, [0, 1], [0, -18], 'extend')
  const rotate = interpolateJS(value, [-1, 0], [-15, 0], 'clamp')
  const zIndex = interpolateJS(
    value,
    itemArr.map((_, index) => index),
    itemArr.map((_, index) => (itemArr.length - index) * 10),
    'extend',
  )

  const scale = interpolateJS(
    value,
    [0, 1, 0],
    [1, 0.95, 1],
    'extend',
  )
  const opacity = interpolateJS(
    value,
    [-1, -0.8, 0, 1],
    [0, 0.9, 1, 1],
    'clamp',
  )

  return {
    transform:
      `translate(${translateX}px, ${translateY}px) rotateZ(${rotate}deg) scale(${scale})`,
    opacity: opacity,
    'transform-origin': 'center',
    zIndex: zIndex,
  }
}

function SwiperEntry() {
  return (
    <view className='demo-container lunaris-dark'>
      <Swiper
        data={itemArr}
        itemWidth={ITEM_WIDTH}
        itemHeight={ITEM_HEIGHT}
        containerWidth={ITEM_WIDTH}
        duration={500}
        initialIndex={0}
        mode='custom'
        main-thread:customAnimation={customAnimation}
        customAnimationFirstScreen={customAnimationFirstScreen}
        style={{
          overflow: 'visible',
        }}
      >
        {({ index }) => (
          <SwiperItem>
            <view
              class='block-view'
              style={{
                width: '100%',
                height: '100%',
                display: 'flex',
                justifyContent: 'center',
                alignItems: 'center',
              }}
            >
              <Card index={index} />
            </view>
          </SwiperItem>
        )}
      </Swiper>
    </view>
  )
}

root.render(<SwiperEntry />)

export default SwiperEntry

```




通过 <code>main-thread:customAnimation</code> 传入 <code>'main thread'</code>{' '}
函数，逐帧逻辑运行在主线程

有了原生基础和可编程的交互，动效不再只是装饰，而是组件行为的一部分。

### Motion

[Motion](https://motion.dev/) 是 Web 社区最知名的动画库之一，同时支持弹簧和贝塞尔曲线过渡。有了[主线程脚本](/next/zh/react/main-thread-script.md)的可编程性做基础，我们把 Motion 搬到了 Lynx 上，实验版随 lynx-ui 一起发布。[`@lynx-js/motion`](/next/zh/ui/motion.md) 通过一层很薄的适配直接使用 Motion 源码，保持了和 Web 完全一致的使用方式。

[`Sheet`](/next/zh/ui/components/sheet.md) 是一个很好的例子。拖拽、阻尼、释放、归位，这些需要连贯成一个完整的行为。主线程脚本让交互紧贴渲染，Motion 控制面板怎么动，两者配合之下，面板给人一种被"握住"的感觉，而不是在回放动画。


**下面是一个示例: lynx-ui-sheet**

**Bundle:** `dist/SheetBasic.lynx.bundle` | Web: `dist/SheetBasic.web.bundle`

```tsx {30-43}
// Copyright 2026 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { root, useRef } from '@lynx-js/react'

import {
  SheetBackdrop,
  SheetContent,
  SheetHandle,
  SheetRoot,
  SheetView,
} from '@lynx-js/lynx-ui'
import type { SheetRootRef } from '@lynx-js/lynx-ui'

import { ActionButton, TriggerButton } from '../shared/index.js'
import './index.css'

const snapPoints = ['50%']

function App() {
  const sheetRef = useRef<SheetRootRef>(null)

  return (
    <view className='demo-container lunaris-dark'>
      <text className='title-text'>Basic Sheet</text>
      <TriggerButton
        onClick={() => sheetRef.current?.open()}
        text='Open Sheet'
      />
      <SheetRoot
        ref={sheetRef}
        snapPoints={snapPoints}
        initialSnap={0}
        onOpen={() => console.log('Sheet opened')}
        onClose={() => console.log('Sheet closed')}
      >
        <SheetView className='sheet-viewport'>
          <SheetBackdrop className='sheet-overlay' clickToClose={true} />
          <SheetContent
            className='sheet-content'
            innerClassName='sheet-inner-content'
          >
            <SheetHandle className='sheet-handle' />
            <view className='control-panel'>
              <text className='header-text'>Basic Sheet</text>
              <text className='info-text'>
                Simple uncontrolled sheet. Drag or tap backdrop to dismiss.
              </text>
              <ActionButton
                onClick={() => sheetRef.current?.close()}
                text='Close'
              />
            </view>
          </SheetContent>
        </SheetView>
      </SheetRoot>
    </view>
  )
}

root.render(<App />)

export default App

```




<code>Sheet</code> 底层使用 <code>@lynx-js/motion</code>{' '}
驱动弹簧拖拽和归位过渡

## 立即体验

lynx-ui 目前已支持 iOS、Android 和 HarmonyOS，Web 和 Desktop 支持也在推进中。阅读[简介](/next/zh/ui/index.md)了解全貌，或直接跳到[快速开始](/next/zh/ui/introduction.md#快速开始)安装 [`@lynx-js/lynx-ui-*`](https://www.npmjs.com/package/@lynx-js/lynx-ui)。

下载 [Lynx Explorer](/next/zh/guide/start/quick-start.md#准备-lynx-explorer)，扫描[组件示例](/next/zh/ui/components/button.md)中的二维码，即可在真机上查看实际效果。你也可以直接将组件集成到自己的 Lynx 应用中，在真实业务流中试用。

我们希望 lynx-ui 能在真实应用的实践中不断成长。如果它体验很好、阻碍了你、或者缺少了什么，请在 [lynx-family/lynx-ui 仓库](https://github.com/lynx-family/lynx-ui)中告诉我们。一起塑造它的未来。
