A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
/* Copyright 2026 Marimo. All rights reserved. */
import { z } from "zod";
import type { IPlugin, IPluginProps } from "@/plugins/types";
import type { VegaLiteSpec } from "./types";
import type { Data, VegaComponentState } from "./vega-component";
import "./vega.css";
import React, { type JSX } from "react";
const LazyVegaComponent = React.lazy(() => import("./vega-component"));
export class VegaPlugin implements IPlugin<VegaComponentState, Data> {
public tagName = "marimo-vega";
public validator = z.object({
spec: z
.looseObject({})
.transform((spec) => spec as unknown as VegaLiteSpec),
chartSelection: z
.union([z.boolean(), z.literal("point"), z.literal("interval")])
.default(true),
fieldSelection: z.union([z.boolean(), z.array(z.string())]).default(true),
embedOptions: z.looseObject({}).default({}),
});
public render(props: IPluginProps<VegaComponentState, Data>): JSX.Element {
return (
<LazyVegaComponent
value={props.value}
setValue={props.setValue}
{...props.data}
/>
);
}
}