@coloop-ai/allotment

中文文档
1.20.7发布于 2026/10/29MITTypeScriptESM + CJS近 30 天下载 1.8万

React split-pane component

原始使用文档
文档目录6 节
  1. Allotment
  2. Quick start
  3. Documentation
  4. Alternatives
  5. Contributing
  6. License

CI status npm version npm downloads Bundle size Types License

Logo

Allotment

React split-pane component.

Docs · Examples · API · Changelog

  • React-based: Integrate effortlessly into your existing React-based application.
  • Industry standard look and feel: Like VS Code's split view implementation? You're in luck! This component is derived from the same codebase.
  • Dynamic: Want to declaratively add and remove panes? We've got you covered.
  • Flexible: Snap panes closed, nest split views, show and hide panes, and persist sizes across reloads.
  • Typed: Written in TypeScript, with type definitions included.

Quick start

npm install allotment

Allotment requires React 17, 18 or 19 (react and react-dom are peer dependencies).

import { Allotment } from "allotment";
import "allotment/dist/style.css";

export const App = () => (
  <div style={{ height: 400 }}>
    <Allotment>
      <div>Pane A</div>
      <div>Pane B</div>
    </Allotment>
  </div>
);

Allotment fills its parent element, so make sure the parent has a height. See the FAQ if nothing is showing.

Documentation

The documentation has live examples of everything Allotment can do.

Alternatives

Allotment aims to reproduce the behaviour of VS Code's split view. If you need something different, react-resizable-panels is a popular alternative.

Contributing

Contributions are welcome! See the contributing guide to get started, and please follow the Code of Conduct.

Notable changes are recorded in the changelog.

License

Allotment is released under the MIT License.

版本与发布记录

@coloop-ai/allotment 共发布 2 个版本,首次发布于 2026/02/13;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.20.7latest2026/10/2912 天前
1.20.62026/02/138 个月前

关于 @coloop-ai/allotment 的常见问题

@coloop-ai/allotment 是什么?

React split-pane component

如何安装 @coloop-ai/allotment?

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

@coloop-ai/allotment 支持 TypeScript 吗?

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

@coloop-ai/allotment 支持 ESM 还是 CommonJS?

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

@coloop-ai/allotment 可以商用吗?

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

@coloop-ai/allotment 的下载量有多少?

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

@coloop-ai/allotment 还在维护吗?

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