feat: add native single-file HTML components - #1207
Open
JovanVeljanoski wants to merge 1 commit into
Open
JovanVeljanoski wants to merge 1 commit into
JovanVeljanoski wants to merge 1 commit into
Conversation
JovanVeljanoski
force-pushed
the
feat_html_template
branch
from
September 23, 2026 13:20
9fee7f8 to
fad69f6
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds
@solara.component_html("greeting.html")as another way to build components for standalone Solara apps. One file holds the component’s HTML template, optional scoped CSS, and optional browser JavaScript. HTML components can be used alongside existing Vue components.Why
Solara already provides a useful connection between Python state and a browser UI. Today, custom component templates use Vue. For many components, plain HTML, CSS, and JavaScript are enough, and they let developers work directly with browser standards without adding a frontend build step.
This is especially helpful when developing a frontend with AI assistance. It is easy to generate and iterate on a self-contained HTML and CSS prototype, then connect only the values and actions that need Python. Interactions such as draft inputs, validation, and focus handling can stay in the component’s JavaScript until the developer chooses to synchronize them.
Keeping markup, styles, and behavior together also makes small visual components easier to reuse. Each component’s CSS is scoped, while shared CSS and JavaScript can still be imported where needed.
What this adds
A Python component declares its synchronized properties and callbacks:
The adjacent HTML file contains the browser view:
data-solara-modelupdates the synchronizednameproperty and callson_namein Python. The reset button invokes the separateevent_resetaction. The optionalmountfunction can useget,set,subscribe, andemitfor more specific behavior—for example, keeping an input draft in JavaScript and sending it to Python only on blur, Enter, or after a pause in typing.Implementation notes
data-solara-*bindings covers text, attributes, DOM properties, form values, and events. The template does not introduce a new expression language.<slot>.component_vue; the existing Vue API and behavior remain in place.Scope
This first version supports standalone Solara apps. Notebook support is outside its scope. The default page shell still uses Vue, so this adds a native HTML component option rather than removing Vue from Solara.
Verification
pre-commit run --all-filespassed, including Ruff, codespell, and mypy checks for ipyvuetify 1 and 3.The full repository browser CI matrix still needs to run on the PR. A broader local integration run in an environment that differs from CI was not fully green, so the targeted results above are not a claim that every existing integration test passes.