@datalayer/jupyter-react

中文文档
2.0.21发布于 2026/10/22MITTypeScriptESM + CJS构建来源已验证近 30 天下载 1.5万

Jupyter React - React.js components 100% compatible with Jupyter.

原始使用文档
文档目录5 节
  1. Releases
  2. Development
  3. Running Examples
  4. Available Examples
  5. Building the Library

Datalayer

Become a Sponsor

🪐 ⚛️ Jupyter React

[!IMPORTANT] Jupyter React 2.0 Released! 🎉

This major release includes breaking changes for the Jupyter and Notebook components:

  • The Notebook2 component is now the default Notebook
  • Instead of using startDefaultKernel prop on components, use the useJupyter({ startDefaultKernel: true }) hook to get serviceManager and defaultKernel, then pass them explicitly to Notebook2
  • Notebook component now require kernel and serviceManager props with conditional rendering
  • See the examples for migration patterns (e.g., PyGWalker.tsx)

Jupyter React is a set of React.js components that allow a frontend developer to build data products compatible with the Jupyter ecosystem. The user interface delivers executable notebooks and cells.

The below image shows a gallery of the available React.js components ready to be used in you custom application. These open source components are used to build the online Datalayer service, a collaborative platform for data analysis.

Jupyter React Gallery

We host a Storybook on ✨ https://jupyter-ui-storybook.datalayer.tech that showcases various low-level as high-level React.js components useful to build a Data Product.

The Jupyter(Lab) notebook is a tool that allows data scientist to analyse dataset. However, it is not easy to create a custom user interface integrated in an existing application. Jupyter React, an open-source library, fills that gap and provides components that a developer can easily integrate in any React.js application.

In terms of technical stack, the Jupyter(Lab) user interface is built on top of Lumino, which is an imperative way to build user interface and can not be consumed by industry standard declarative frameworks like React.js. As a user interface developer, if you want to create a custom data product on top of Jupyter, you have to stick to Lumino and carry-on the full notebook interface not tailored to your specific needs. This is not what you want. You just want to expose what you need, you want to develop with your favorite toolkit (like React.js) and you also want to integrate on a per-component basis the Jupyter functionality in your application.

Although a developer can embed a React.js component into JupyterLab, the reverse is not possible: you can not embed JupyterLab into a React.js application. To solve that issue, Jupyter-React ships components to easily create a React.js data product compatible with the Jupyter ecosystem. Those components can be used in any React.js application, and also in static websites like Docusaurus, Next.js or Remix. They wrap underneath the JupyterLab code and allow developing React.js applications with code execution capability. State management is based on Zustand.

flowchart LR
    subgraph Host["Host React Application"]
        HA[Components]
    end

    subgraph Zustand["Zustand Store"]
        ZA[Actions]
        ZS[State]
    end

    subgraph JupyterUI["Jupyter UI"]
        JR[React Components]
    end

    subgraph JupyterLab["JupyterLab/Lumino"]
        LC[Commands]
        LS[Signals]
        LW[Widgets]
    end

    subgraph Kernel["Jupyter Server"]
        K[Kernel]
    end

    HA -->|"dispatch"| ZA
    ZA -->|"proxy"| LC
    LC -->|"execute"| LW
    LW -->|"request"| K

    K -->|"response"| LS
    LS -->|"emit"| ZS
    ZS -->|"subscribe"| HA

    JR -.->|"wraps"| LW

IPyWidgets are supported (the Comm feature needs to be fixed). JupyterLite and PyScript support is on the roadmap. Autocompletion is also available.

You can find more context reading this abstract of the talk given at FOSDEM 2022 (video recording).

As a React.js developer, you just write a few lines of code get a live notebook or live cell in your application.

Jupyter React Slate

The typedoc documentation is available online.

Jupyter React can be used in any React.js application. Install the latest @datalayer/jupyter-react npm package and get inspired by the examples in this repository.

Jupyter React Slate

Releases

Jupyter React is released in Npm.js and PyPI.

Development

Running Examples

This package includes multiple example applications demonstrating various Jupyter React components. You can run these examples using either Vite (recommended) or Webpack.

Vite provides faster development server startup and hot module replacement (HMR).

# Install dependencies
npm install

# Start development server (default example: Notebook2Actions)
npm run dev:vite

# Or use these alternative commands
npm run start:vite              # Same as dev:vite
npm run start-local:vite        # Use local Jupyter server (http://localhost:8686)
npm run start-noconfig:vite     # Run without config
npm run build:vite              # Production build
npm run preview:vite            # Preview production build

The dev server runs on http://localhost:3208.

To run a different example, edit the entry point in index.html:

<script type="module" src="/src/examples/YourExample.tsx"></script>

Using Webpack

Webpack is still available for backward compatibility.

# Start development server
npm run start:webpack

# Or use these alternative commands
npm run start-local:webpack     # Use local Jupyter server
npm run start-noconfig          # Run without config (webpack)
npm run build:webpack           # Production build with webpack

Available Examples

The following examples are available in src/examples/:

  • Notebook2Actions - Notebook with action bar controls
  • Cell / CellLite - Single cell examples
  • Notebook / NotebookLite - Full notebook examples
  • Console / ConsoleLite - Console examples
  • IPyWidgets - IPyWidgets integration
  • JupyterLabApp - Full JupyterLab application
  • Terminal - Terminal component
  • And many more...

Building the Library

# Build TypeScript library
npm run build:lib

# Full build (resources + TypeScript + webpack)
npm run build

# Production build
npm run build:prod

版本与发布记录

@datalayer/jupyter-react 共发布 150 个版本,首次发布于 2022/01/30;过去 12 个月发布了 27 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.21latest2026/10/2220 天前
2.0.202026/10/061 个月前
2.0.192026/10/061 个月前
2.0.182026/09/261 个月前
2.0.172026/09/251 个月前
2.0.162026/09/251 个月前

关于 @datalayer/jupyter-react 的常见问题

@datalayer/jupyter-react 是什么?

Jupyter React - React.js components 100% compatible with Jupyter.

如何安装 @datalayer/jupyter-react?

在项目目录运行 npm install @datalayer/jupyter-react,或使用 pnpm add / yarn add / bun add。

@datalayer/jupyter-react 支持 TypeScript 吗?

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

@datalayer/jupyter-react 支持 ESM 还是 CommonJS?

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

@datalayer/jupyter-react 可以商用吗?

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

@datalayer/jupyter-react 的下载量有多少?

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

@datalayer/jupyter-react 还在维护吗?

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