Examples¶
Every example is one runnable file: uv run python examples/01_form_basic.py starts a
NiceGUI app that explains itself on its own first page. The pages here show the same
text, a screenshot of what it looks like, and the source.
| # | Example | Shows |
|---|---|---|
| 01 | ModelForm — Basic | Demonstrates ModelForm with a simple Pydantic model. |
| 02 | ModelForm — Field Types | One form showing all field types supported by NiceView: |
| 03 | ModelForm — NiceGUI Binding | The left panel shows a ModelForm. The right panel uses NiceGUI's |
| 04 | ModelForm — JSON Persistence | Two rows, each pairing a form variant with a live JSON file viewer: |
| 05 | ModelGrid | Three variants of the AgGrid-based table component: |
| 06 | EditGridWrapper / EditFormWrapper | Wrappers that add chrome (title + action buttons) on top of a grid or form: |
| 07 | SqlModelAdapter | Advanced example: SqlModelAdapter connects ModelForm and ModelGrid |
| 08 | Reactive Grid — Auto-update via ObservableList | Demonstrates the difference between a grid backed by a plain list and one backed |
| 09 | DrillDownWrapper / ModelList | Embeddable list <-> detail navigation: a contact list that opens a detail form per item. |
| 10 | Split-Panel Form Navigation | Responsive master-detail navigation around ModelForm: |
| 11 | Multi-Level Tree Navigation | URL-addressable drill-down over three levels with explicit back buttons: |
| 12 | Card-Based List Editing | ModelGrid/EditGridWrapper render a list as a table with Add/Edit/Delete dialogs — great for |
| 13 | DrillDownWrapper — Directory of Files (with Rename) | DrillDownWrapper's two first-class use cases: a JSON list inside one file (see |
| 14 | render_field — a form without a model | niceview.render_field(field_info, value) renders one widget from one niceview.Field(), |
| 15 | Validation — three layers, and what gets written when | Every change runs through the same three layers, in this order: |
| 16 | ModelForm — Layout | By default a form stacks its fields. A layout arranges them, written as a nested list of |
| 17 | Styling | Styling and texts: the two application-wide defaults, and the presets you would build on top. |
| 18 | Actions — buttons that are not fields | A form sometimes needs a button that is not a field: Test connection next to the host, |