Keyword options¶
Every component takes its configuration as keyword arguments, and every set of them is declared
as a TypedDict that the factory methods unpack (**kwargs: Unpack[_ModelFormOptionInputs]).
That is what makes an unknown keyword a TypeError and a known one an editor completion — and
it is where each option's own description lives, which is why these otherwise private types are
documented here.
The names begin with an underscore because they are not meant to be imported or subclassed. Read them as the option list of the component they belong to.
Two sources for the same option
Most of these can also be set on the model's Meta class, where the answer belongs to the
model rather than to one view of it — a keyword argument then wins over Meta. See
Field types.
Form¶
_ModelFormOptionInputs
¶
Kwarg Options for the ModelForm class. Chrome (title, description, save/refresh buttons) belongs to EditFormWrapper.
Source code in niceview/modelform.py
include
instance-attribute
¶
Fields to show; 'all' (default) or a list of names.
field_infos
instance-attribute
¶
Per-field FieldInfo overrides, by field name.
profile
instance-attribute
¶
profile: str | None
Named field layout profile from Meta.profiles (e.g. 'summary', 'detail'). Defaults to Meta.default_profile when omitted.
layout
instance-attribute
¶
layout: list
Inline field layout: a nested list of field names — rows/columns, '# Title' cards, '@name' places an action. Same notation as a Meta.profiles entry.
actions
instance-attribute
¶
actions: dict[str, FormAction]
The form's action buttons, by name: buttons that are not fields ('Test connection'). Placed in the layout as '@name', or by hand with render_action('name').
base_props
instance-attribute
¶
base_props: str
Quasar props applied to every field of this form (e.g. 'outlined dense'). Additive: the field's own props are merged on top, per key, so a field can add or change a single prop.
default_classes
instance-attribute
¶
default_classes: str
CSS classes for every field of this form that brings none of its own (e.g. 'w-full'). A fallback, not a base: any classes on the field or in the layout replace it wholesale.
autosave
instance-attribute
¶
autosave: bool
Whether to automatically save the form on field change. Defaults to False (OFF).
local_tz
instance-attribute
¶
local_tz: str | None
Local timezone name for datetime display (e.g. 'Europe/Berlin'). Defaults to None (system local timezone).
on_change
instance-attribute
¶
on_change: Handler[FieldChangeEventArguments]
Callback to execute when value changes. To reduce the number of change events, fields like ui.input or ui.number also have to loose focus (blur).
required_marker
instance-attribute
¶
required_marker: str | None
Appended to the label of a required field. Defaults to ' *'; None renders no marker.
required_message
instance-attribute
¶
required_message: str
Validation message for an empty required field. Defaults to 'Required'.
description_as
instance-attribute
¶
Where a field's pydantic description shows: 'tooltip' (default), 'hint', or None. An
explicit hint/tooltip on the field always wins.
chrome_style
instance-attribute
¶
chrome_style: ChromeStyle | None
Look of the section titles of this form's layout. Replaces the application-wide default of niceview.style.set_chrome_style() wholesale — derive it with ChromeStyle.derived().
chrome_text
instance-attribute
¶
chrome_text: ChromeText | None
Texts of this form. Replaces the application-wide default of niceview.text.set_chrome_text() wholesale — derive it with ChromeText.derived().
_EditFormWrapperInputs
¶
Source code in niceview/editwrapper.py
title
instance-attribute
¶
title: str | None
Form title; omitted/None/'' all show none — a form edits one item, so nothing is auto-generated. Defaults from Meta.title.
description
instance-attribute
¶
description: str | None
Markdown below the title row. Defaults from Meta.description.
save_button
instance-attribute
¶
save_button: str | None
Save button label; '' for icon-only, None hides it. Shown by default when there's an adapter (from_json/from_adapter); suppressed entirely by autosave.
refresh_button
instance-attribute
¶
refresh_button: str | None
Refresh button label; '' for icon-only, None hides it. Shown by default when there's an adapter (from_json/from_adapter).
chrome_actions
instance-attribute
¶
chrome_actions: dict[str, FormAction]
The application's own buttons in the title row, by name, left of Refresh and Save. Same
FormAction as the form's actions — the one that is placed in the layout as '@name'.
chrome_style
instance-attribute
¶
chrome_style: ChromeStyle | None
Look of the title row and its buttons. Replaces the application-wide default of niceview.style.set_chrome_style() wholesale — derive it with ChromeStyle.derived(). Passed on to the wrapped ModelForm, whose section titles it styles too.
chrome_text
instance-attribute
¶
chrome_text: ChromeText | None
Texts of the tooltips and notifications. Replaces the application-wide default of niceview.text.set_chrome_text() wholesale — derive it with ChromeText.derived().
Grid¶
_ModelGridOptionInputs
¶
Keyword options for ModelGrid and its factory methods.
Source code in niceview/modelgrid.py
include
instance-attribute
¶
Fields to show; 'all' (default) or a list of names.
field_infos
instance-attribute
¶
Per-field FieldInfo overrides, by field name.
profile
instance-attribute
¶
profile: str | None
Named field layout profile from Meta.profiles (e.g. 'summary', 'detail'). Defaults to Meta.default_profile when omitted.
local_tz
instance-attribute
¶
local_tz: str | None
Timezone for datetime column display (e.g. 'Europe/Berlin'), like ModelForm's.
auto_size_columns
instance-attribute
¶
auto_size_columns: bool
Auto-size columns to fit their content.
defaultColDef
instance-attribute
¶
defaultColDef: dict
ag-grid defaultColDef, merged into every column.
rowSelection
instance-attribute
¶
rowSelection: Literal[None, 'single', 'multiple']
ag-grid row selection mode.
cell_renderers
instance-attribute
¶
Per-field value -> display-string converters, by field name.
_EditGridWrapperInputs
¶
Source code in niceview/editwrapper.py
title
instance-attribute
¶
title: str | None
Title above the grid; omitted or None auto-generates '{ItemType} List', '' shows none, any other string is used verbatim. Defaults from Meta.title_plural (the collection heading) when this kwarg is not passed — never from the singular Meta.title.
description
instance-attribute
¶
description: str | None
Markdown below the title row. Defaults from Meta.description when not passed.
on_add
instance-attribute
¶
Replaces the default Add action (create item_type() and open the create dialog). Sync or async — an async handler can ask for input via util.input_dialog() before creating anything.
delete_button
instance-attribute
¶
delete_button: str | None
Delete button label; '' for icon-only (default), None hides it.
add_button
instance-attribute
¶
add_button: str | None
Add button label; '' for icon-only (default), None hides it.
edit_button
instance-attribute
¶
edit_button: str | None
Edit button label; '' for icon-only (default), None hides it — the default for an inline-editable grid, which needs no separate dialog.
refresh_button
instance-attribute
¶
refresh_button: str | None
Refresh button label; '' for icon-only (default when there's an adapter to reload from), None hides it.
chrome_actions
instance-attribute
¶
chrome_actions: dict[str, FormAction]
The application's own buttons in the title row, by name, left of niceview's own. Same
FormAction as a form's actions — its on_click gets a GridActionEventArguments here.
chrome_style
instance-attribute
¶
chrome_style: ChromeStyle | None
Look of the title row and its buttons. Replaces the application-wide default of niceview.style.set_chrome_style() wholesale — derive it with ChromeStyle.derived().
chrome_text
instance-attribute
¶
chrome_text: ChromeText | None
Texts of the tooltips, dialogs and notifications. Replaces the application-wide default of niceview.text.set_chrome_text() wholesale — derive it with ChromeText.derived().
List and drill-down¶
_ModelListOptionInputs
¶
Keyword options for ModelList and its factory methods.
Source code in niceview/modellist.py
include
instance-attribute
¶
Fields to show; 'all' (default) or a list of names.
field_infos
instance-attribute
¶
Per-field FieldInfo overrides, by field name.
profile
instance-attribute
¶
profile: str | None
Named field layout profile from Meta.profiles (e.g. 'summary', 'detail'). Defaults to Meta.default_profile when omitted.
local_tz
instance-attribute
¶
local_tz: str | None
Timezone for datetime display (e.g. 'Europe/Berlin'), like ModelForm's.
title_field
instance-attribute
¶
title_field: str | None
Field shown as each row's title; the first visible field if omitted.
subtitle_fields
instance-attribute
¶
Fields shown as each row's subtitle; the next two visible fields if omitted.
chrome_style
instance-attribute
¶
chrome_style: ChromeStyle | None
Look of the list and its rows. Replaces the application-wide default of niceview.style.set_chrome_style() wholesale — derive it with get_chrome_style().replace().
_DrillDownWrapperOptionInputs
¶
Keyword options for DrillDownWrapper and its factory methods.
Source code in niceview/drilldown.py
title
instance-attribute
¶
title: str | None
List title; None auto-generates '{ItemType} List', '' hides it. Defaults to Meta.title_plural; the detail view always shows the item's own title instead.
description
instance-attribute
¶
description: str | None
Markdown below the title row, in both views. Defaults to Meta.description.
item_title_field
instance-attribute
¶
item_title_field: str | None
Field shown as the detail title; auto-detected (first visible field) if omitted.
item_subtitle_fields
instance-attribute
¶
Fields shown as list-row subtitles; the next two visible fields if omitted.
title_field
instance-attribute
¶
title_field: str | None
Alias of item_title_field (the name ModelList uses); item_title_field wins if both given.
subtitle_fields
instance-attribute
¶
Alias of item_subtitle_fields (the name ModelList uses).
add_button
instance-attribute
¶
add_button: str | None
Add button label; '' for icon-only (default), None hides it.
delete_button
instance-attribute
¶
delete_button: str | None
Delete button label; '' for icon-only (default), None hides it.
back_button
instance-attribute
¶
back_button: str | None
Back button label; '' for icon-only (default). None omits it — the detail view then needs its own way back.
search
instance-attribute
¶
search: bool
Show a free-text search box in the list view's title row, left of list_actions/Add, filtering rows across all visible fields (client-side) as the user types. Off by default; hidden in the detail view.
list_actions
instance-attribute
¶
list_actions: dict[str, FormAction]
Buttons in the list view's title row, left of Add; hidden in the detail view. on_click gets a DrillDownListActionEventArguments (no key/item), and requires_valid is rejected.
detail_actions
instance-attribute
¶
detail_actions: dict[str, FormAction]
Buttons in the detail view's title row, left of Delete; hidden in the list view. on_click gets a DrillDownActionEventArguments with the item on screen; chrome_actions is an alias (detail_actions wins if both given).
chrome_actions
instance-attribute
¶
chrome_actions: dict[str, FormAction]
Deprecated alias of detail_actions, kept for backward compatibility.
chrome_style
instance-attribute
¶
chrome_style: ChromeStyle | None
Look of the title row, its buttons and the list rows. Replaces the application-wide default of niceview.style.set_chrome_style() wholesale — derive it with ChromeStyle.derived().
chrome_text
instance-attribute
¶
chrome_text: ChromeText | None
Texts of the tooltips, dialogs and notifications. Replaces the application-wide default of niceview.text.set_chrome_text() wholesale — derive it with ChromeText.derived().
place
instance-attribute
¶
place: Place
Where this wrapper's buttons sit in the chrome cascade: 'toolbar' (default) for a wrapper of its own, 'form' for one embedded in a form.
on_add
instance-attribute
¶
Replaces the default Add action (create item_type() and open it). Sync or async — an async handler can ask for a name via util.input_dialog() before creating anything.
on_back
instance-attribute
¶
Shows a Back button in the list view too (for nesting) and runs on its click. Sync or async — an async handler can confirm via util.confirm_dialog() before leaving.
render_list_item
instance-attribute
¶
Custom renderer for one list row, replacing the default ModelList row.
render_list_container
instance-attribute
¶
Wraps the rendered rows in a custom container, e.g. for make_sortable.
render_detail
instance-attribute
¶
Custom renderer for the detail view, replacing the default autosaving form.
include
instance-attribute
¶
Fields to show; forwarded to ModelList when render_list_item is not set.
exclude
instance-attribute
¶
Fields to hide; forwarded to ModelList when render_list_item is not set.
field_infos
instance-attribute
¶
Per-field FieldInfo overrides; forwarded to ModelList when render_list_item is not set.
Field¶
The arguments of niceview.Field(), which builds a
FieldInfo.
_FieldInfoInputs
¶
Keyword options for FieldInfo(); mirrors its attributes for kwarg type-checking.
Source code in niceview/fieldinfo.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
placeholder
instance-attribute
¶
placeholder: str
Placeholder text shown in an empty text-like widget.
field_type
instance-attribute
¶
field_type: type
Python type of the value. ModelForm sets this from the model annotation; set it explicitly for render_field().
editable
instance-attribute
¶
editable: bool
Whether the widget accepts input; False renders it disabled.
hint
instance-attribute
¶
hint: str
Help text below the widget (Quasar's hint prop); ignored by widgets with no hint slot.
description
instance-attribute
¶
description: str
Help text from pydantic's description; shown as hint or tooltip per description_as=,
unless an explicit hint/tooltip wins.
widget_type
instance-attribute
¶
Which element renders the field; inferred from the type if omitted.
options
instance-attribute
¶
Choices for select/radio/toggle/checkbox_group widgets.
password_toggle_button
instance-attribute
¶
password_toggle_button: bool
Show/hide toggle for a password input.
autocomplete
instance-attribute
¶
Autocomplete suggestions for a text input.
validation
instance-attribute
¶
Extra validation beyond required: a NiceGUI ValidationFunction or dict.
number_format
instance-attribute
¶
number_format: str
Display format of ui.number, e.g. '%.2f'. Named number_format, not format, to keep it
apart from JSON Schema's format, which corresponds to widget_type.
clearable
instance-attribute
¶
clearable: bool
Offer a clear button on select-like and text widgets. Clearing writes None.
key_generator
instance-attribute
¶
Generates a dict key for a new value typed into ui.select.
color_preview
instance-attribute
¶
color_preview: bool
Show a color swatch preview next to ui.color_input.
new_value_mode
instance-attribute
¶
new_value_mode: Literal['add', 'add-unique', 'toggle']
How ui.input_chips treats a typed value not already in the list.
item_type
instance-attribute
¶
item_type: type
Item's pydantic type for editgrid/modelselect fields.
table_label
instance-attribute
¶
table_label: str
Column header label; defaults to the field's label.
table_hidden
instance-attribute
¶
table_hidden: bool
Hide the column in a table/grid (the field may still show in a form).
table_align
instance-attribute
¶
table_align: Literal['left', 'center', 'right']
Horizontal text alignment of the cell.
table_cell_style
instance-attribute
¶
table_cell_style: str
Extra CSS for the cell, merged with table_align.
table_sort
instance-attribute
¶
table_sort: Literal['asc', 'desc']
Default sort order for the column.
table_filterable
instance-attribute
¶
table_filterable: bool
Show a filter row for the column; filter type inferred from the field type.
table_floating_filter
instance-attribute
¶
table_floating_filter: bool
Show a floating filter row for the column.