Features
Type-safe elements
IDE autocomplete and type hints for every HTML element. Catch errors before runtime.
Zero dependencies
Just Python 3.8+ and nothing else. No heavy framework to install.
Composable components
Build reusable components as Python classes with slots and props.
Framework agnostic
Works with FastAPI, Django, Flask, or standalone scripts.
HTMX integration
First-class support for building interactive UIs without writing JavaScript.
Form builder
Generate HTML5 forms with validation attributes using the Field class.
JSON serialization
Convert element trees to and from JSON for drag-and-drop builders.
CSS style helpers
StyleSheet and Theme classes for managing CSS with pseudo-selectors and breakpoints.
Raw HTML partials
Embed trusted raw HTML for analytics snippets and third-party embeds.
Quick example
from nitro_ui import Div, H1, Paragraph, Href, Nav, UnorderedList, ListItem
page = Div(
Nav(
UnorderedList(
ListItem(Href("Home", href="/")),
ListItem(Href("About", href="/about")),
),
),
H1("Welcome"),
Paragraph("Built with NitroUI"),
cls="container"
)
print(page.render(pretty=True))