Skip to content

Instantly share code, notes, and snippets.

@poke1024
Created August 1, 2025 10:13
Show Gist options
  • Select an option

  • Save poke1024/3d8b969c597c851a1c5765ef527bc6af to your computer and use it in GitHub Desktop.

Select an option

Save poke1024/3d8b969c597c851a1c5765ef527bc6af to your computer and use it in GitHub Desktop.
SolidJS inside anywidget (marimo)
import anywidget
import traitlets
import marimo as mo
class ExampleWidget(anywidget.AnyWidget):
_esm = """
import {
createSignal,
onCleanup,
} from "https://cdn.skypack.dev/solid-js";
import { render as renderSolidJS } from "https://cdn.skypack.dev/solid-js/web";
import html from "https://cdn.skypack.dev/solid-js/html";
function render({ model, el }) {
const App = () => {
const [count, setCount] = createSignal(0);
const click = (e) => {setCount(count() + 1)};
return html`<div onClick=${click}>${count}</div>`;
};
renderSolidJS(App, el);
}
export default { render };
"""
widget = mo.ui.anywidget(ExampleWidget())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment