Skip to content

@jupyter-kit/react

React wrapper — an <Notebook> component that mounts createRenderer() inside a React tree. All options from @jupyter-kit/core are exposed as props, with a few additions.

<Notebook> props

PropTypeRequiredNotes
ipynbIpynbThe parsed notebook to render. Parse JSON yourself (JSON.parse(text)) before passing.
pluginsPlugin[]Same as RendererOptions.plugins.
executorExecutorSame as RendererOptions.executor.
languagestringFallback cell language. Default 'python'.
languagesLanguageDef[]Lezer parsers.
htmlFilterHtmlFilterReplace the default sanitiser.
onSaveSaveHandlerOverride Ctrl/Cmd+S.
bgTransparentbooleanDefault true.
seqAsExecutionCountbooleanDefault false.
classNamestringExtra class on the root.
filenamestringDefault 'notebook.ipynb'.
mathAlign'left' | 'center' | 'right'Default 'left'.
onReady(handle: RendererHandle) => voidFires once after mount. Stash the handle for imperative calls (.update(), .cell(i), …).

Usage

import { Notebook } from '@jupyter-kit/react';
import { python } from '@jupyter-kit/core/langs/python';
import '@jupyter-kit/theme-default/default.css';
import '@jupyter-kit/theme-default/syntax/one-dark.css';
<Notebook
ipynb={notebook}
language="python"
languages={[python]}
/>;

Peer dependencies

react ≥ 16.9, react-dom ≥ 16.9. Works under strict mode and in Suspense — the component mounts once on the client.

SSR / RSC

The renderer touches the DOM (CodeMirror, sanitizers, plugins), so it’s client-only. In Next.js App Router / React Server Components, wrap in a 'use client' boundary or dynamic-import with { ssr: false }. In Astro, use client:only="react".