# NiceGUI

> Build web UIs in pure Python, served straight to your browser

- Category: App UIs & Builders / Data App Builders
- Language: Python
- Repository: https://github.com/zauberzeug/nicegui
- Website: https://nicegui.io
- Canonical page: https://ai-tldr.dev/tools/nicegui/

## In short

NiceGUI is a Python UI framework that renders your interface in a web browser. You write Python code to create elements like buttons, inputs, dialogs, Markdown, plots, tables, and 3D scenes, and NiceGUI handles the frontend for you. It sits in the Data App Builders category of the App UIs & Builders tools and is open-source, written in Python.

## Overview

NiceGUI is a Python UI framework that renders your interface in a web browser. You write Python code to create elements like buttons, inputs, dialogs, Markdown, plots, tables, and 3D scenes, and NiceGUI handles the frontend for you. It is built on FastAPI on the backend and Vue plus Quasar on the frontend.

It is aimed at Python developers who want a graphical interface without writing HTML, CSS, or JavaScript. The project highlights micro web apps, dashboards, robotics projects, and smart home setups, and it also works well for development tasks such as tuning a machine learning algorithm or configuring a controller.

As a data app builder, NiceGUI keeps the logic backend-first: state lives in your Python code rather than being driven by frontend magic. It can run as a web server accessed by a browser, in native mode as a desktop window, and inside Jupyter notebooks.

## What it does

- Standard GUI elements out of the box: label, button, checkbox, switch, slider, input, file upload, and more, grouped with rows, columns, cards, and dialogs
- High-level elements for plotting graphs and charts, rendering 3D scenes, annotating images, and working with tables and tree structures
- Automatic page reload when you change your code, so you see updates without a manual restart
- Runs as a web server, in native desktop-window mode, or inside Jupyter notebooks and Python's interactive mode
- Data binding, refreshable functions, and a built-in timer to refresh data at intervals as short as 10 ms
- Built on FastAPI, Starlette, and Uvicorn, with a pytest-based testing framework included

## Getting started

Install the package from PyPI, write a short main.py, and run it to open the GUI in your browser.

1. Install NiceGUI

   Install the package from PyPI with pip.

```bash
python3 -m pip install nicegui
```

2. Write your GUI

   Create a file named main.py with a label, a button, and a call to ui.run().

```python
from nicegui import ui

ui.label('Hello NiceGUI!')
ui.button('BUTTON', on_click=lambda: ui.notify('button was pressed'))

ui.run()
```

3. Launch it

   Run the file with Python, then open http://localhost:8080/ in your browser. NiceGUI reloads the page automatically when you change the code.

```bash
python3 main.py
```

## When to use it

- Build internal tools and dashboards for a team without setting up a separate frontend stack
- Create a control panel or live UI for a robotics, smart home, or hardware project
- Add a quick interface for tuning or monitoring a machine learning algorithm or controller during development
- Ship a small native desktop app or micro web app from a single Python file
