NiceGUI Components
40+ Built-in Components
| Category | Components |
|---|---|
| Basic | label, button, input, textarea, slider, toggle, switch |
| Layout | row, column, card, tabs, stepper, dialog, drawer |
| Data | table, aggrid, tree, json_editor |
| Charts | plotly, matplotlib, echarts, highcharts |
| Media | image, video, audio, 3D scene |
| AI/ML | chat_message, markdown, code, mermaid |
| Upload | upload, download |
AI Dashboard Example
from nicegui import ui
import plotly.express as px
import pandas as pd
df = pd.DataFrame({"epoch": range(20), "loss": [1/(i+1) for i in range(20)]})
with ui.card():
ui.label("Training Dashboard").classes("text-2xl font-bold")
ui.plotly(px.line(df, x="epoch", y="loss", title="Training Loss"))
with ui.card():
ui.label("Model Inference")
prompt = ui.input("Enter prompt")
ui.button("Generate", on_click=lambda: run_inference(prompt.value))
output = ui.markdown("")
ui.run()Tailwind CSS Integration
ui.label("Styled text").classes("text-xl font-bold text-blue-500 p-4")
ui.button("Fancy button").classes("bg-gradient-to-r from-purple-500 to-pink-500")Auto-Reload
Edit your Python file and the browser refreshes automatically — no manual restart needed during development.
Multi-Page Apps
@ui.page("/")
def home():
ui.label("Home Page")
ui.link("Go to Dashboard", "/dashboard")
@ui.page("/dashboard")
def dashboard():
ui.label("Dashboard")Docker Deployment
FROM python:3.11-slim
RUN pip install nicegui
COPY main.py .
CMD ["python", "main.py"]FAQ
Q: What is NiceGUI? A: NiceGUI is a Python UI framework with 15,500+ GitHub stars for building web interfaces with pure Python. 40+ components, Tailwind CSS, auto-reload, and no JavaScript required.
Q: How is NiceGUI different from Streamlit? A: NiceGUI gives you more control — proper component layout, custom styling with Tailwind, multi-page routing, and FastAPI integration. Streamlit is simpler but more limited. NiceGUI is closer to "real web development" while staying in Python.
Q: Is NiceGUI free? A: Yes, open-source under MIT license.