JGuang / JGuang UI
Components组件Base UIBase UI 组件

可调整面板

允许用户拖动分隔线调整相邻区域大小。

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

About

The Resizable component is built on top of react-resizable-panels by bvaughn.

安装

Command

Manual

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

安装以下依赖:

npm install react-resizable-panels

将以下代码复制到你的项目中。

View complete source: components/ui/resizable.tsx

根据项目配置更新导入路径。

用法

import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"
<ResizablePanelGroup orientation="horizontal">
  <ResizablePanel>One</ResizablePanel>
  <ResizableHandle />
  <ResizablePanel>Two</ResizablePanel>
</ResizablePanelGroup>

Composition

Use the following composition to build a ResizablePanelGroup:

ResizablePanelGroup
├── ResizablePanel
├── ResizableHandle
└── ResizablePanel

Vertical

Use orientation="vertical" for vertical resizing.

Loading JGuang UI example…

Handle

Use the withHandle prop on ResizableHandle to show a visible handle.

Loading JGuang UI example…

从右到左布局

To enable RTL support in JGuang UI, see the RTL configuration guide.

Loading JGuang UI example…

API 参考

See the react-resizable-panels documentation.

Changelog

2025-02-02 ,[object Object], v4

Updated to react-resizable-panels v4. See the v4.0.0 release notes for full details.

If you're using react-resizable-panels primitives directly, note the following changes:

v3v4
PanelGroupGroup
PanelResizeHandleSeparator
direction proporientation prop
defaultSize={50}defaultSize="50%"
onLayoutonLayoutChange
ImperativePanelHandlePanelImperativeHandle
ref prop on PanelpanelRef prop
data-panel-group-directionaria-orientation

The JGuang UI wrapper components (ResizablePanelGroup, ResizablePanel, ResizableHandle) remain unchanged.

来源: components/base/resizable.mdx

JGuang UI 技术文档。

On this page