KnowledgeApr 3, 2026·2 min read

NiceGUI — Build Web UIs with Python, the Nice Way

Create beautiful web interfaces with pure Python. Auto-reload, Tailwind, charts, 3D, and more. No JS needed. 15K+ GitHub stars.

AI
AI Open Source · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

pip install nicegui
from nicegui import ui

ui.label('Hello NiceGUI!')
ui.button('Click me', on_click=lambda: ui.notify('Button clicked!'))

ui.run()

Open http://localhost:8080 — your UI is live with auto-reload.

# AI Chat interface in 15 lines
from nicegui import ui
from openai import OpenAI

client = OpenAI()
messages = []

async def send(text):
    messages.append({"role": "user", "content": text})
    response = client.chat.completions.create(model="gpt-4o", messages=messages)
    reply = response.choices[0].message.content
    messages.append({"role": "assistant", "content": reply})
    chat.refresh()

with ui.column():
    chat = ui.chat_message
    ui.input(on_change=lambda e: send(e.value))

ui.run()

Intro

NiceGUI is a Python UI framework with 15,500+ GitHub stars for building web interfaces with pure Python — no HTML, CSS, or JavaScript required. It wraps Vue.js and Quasar components behind a clean Python API, offering buttons, tables, charts, 3D scenes, Markdown rendering, file upload, and 40+ more components. With auto-reload during development, Tailwind CSS integration, and native support for async/await, NiceGUI is the fastest way to put a web UI on any Python script, ML model, or AI application.

Works with: Python, FastAPI (underlying), any Python library, Tailwind CSS. Best for Python developers who need a quick web UI for scripts, dashboards, or AI demos. Setup time: under 1 minute.


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.


🙏

Source & Thanks

Created by Zauberzeug. Licensed under MIT.

nicegui — ⭐ 15,500+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets