InputForm#
- class ansys.solutions.dash_super_components.InputForm(items: list[dict[str, Any]], title: str | None = None, with_card: bool = True, card_props: dict[str, Any] | None = None, title_props: dict[str, Any] | None = None, column_names: list[str] | None = None, column_widths: dict[str, int] | None = None, aio_id: str | None = None, columns: list[str] | None = None, persistence: bool = False, persistence_type: str | None = None)#
Bases:
DivAll-in-one component based on Dash Mantine Components to create input forms.
Each row of the form is defined by a dictionary with the following keys:
fields(required): list of field dicts. Each field dict must contain"type"and"id"keys plus any additional properties accepted by the underlying Dash Mantine component. Supported types:NumberInput,TextInput,PasswordInput,Checkbox,Select,MultiSelect,Slider,Switch.label(optional): str — label text shown in the label column.unit(optional): str — LaTeX-rendered unit shown in the unit column.description(optional): str — description text shown in the description column.help(optional): Dash component(s), str, or number — content shown in a modal when the help icon is clicked.id(optional): str — explicit row identifier used as therow_indexin component IDs. When omitted, the zero-based row position is used instead.
UI-side value persistence is disabled by default. It can be enabled globally for all fields via the
persistenceandpersistence_typeconstructor parameters. Individual fields can override the global setting by including a"persistence"key in their field dict.- Parameters:
- items
listofdict A list of row definitions. Each dict must contain a
"fields"key whose value is a list of field dicts (each requiring"type"and"id"). Optional row keys:"label","unit","description","help","id". Fields also accept a"hidden": Truekey to hide the field on initialization. To override the global persistence setting for an individual field, pass"persistence": Trueor"persistence": Falsein the field dict.- title
str,optional Title displayed above the form.
- with_card
bool,optional Whether to wrap the form in a
dmc.Card. Default isTrue.- card_props
dict,optional Additional properties forwarded to
dmc.Card.- title_props
dict,optional Additional properties forwarded to the title
html.Pelement.- column_names
listofstr,optional Header labels for each column, in the same order as
columns. Pass an empty list (default) to omit column headers.- column_widths
dict,optional Mapping of column names to integer grid-span widths. Columns omitted here use built-in defaults.
- aio_id
str,optional Unique identifier for this component instance. A UUID is generated when not provided.
- columns
listofstr,optional Ordered list of column names to display. Supported values:
"label","fields","unit","description","help". Defaults to all five columns in the order listed.- persistence
bool,optional Whether to enable UI-side persistence for all form fields. When
True, user-entered values survive page navigation within the same browser tab. Individual fields can override this setting via"persistence"in the field dict. Default isFalse.- persistence_type
str,optional The Dash persistence storage type to use when
persistenceisTrue. Accepted values:"memory"(cleared on page reload),"session"(cleared when the browser tab is closed),"local"(persists across reloads and browser restarts). Default is"memory".
- items
IDs
- class ansys.solutions.dash_super_components.InputForm.InputFormIds#
Bases:
AIOIdsProvides IDs for the subcomponents of
InputForm.- classmethod description(aio_id: str | Wildcard, row_index: str | int | Wildcard) dict[str, Any]#
Return the id for an input form description.
- classmethod field(aio_id: str | Wildcard, field_type: str | Wildcard, field_id: str | Wildcard, row_index: str | int | Wildcard) dict[str, Any]#
Return the id for an input form field.
- Parameters:
- aio_id
stror_Wildcard The component’s unique identifier.
- field_type
str,or_Wildcard The unique type of the field within the form (field[“type”]).
- field_id
str,or_Wildcard The unique identifier of the field within the form (field[“id”]).
- row_index
str,int,or_Wildcard The unique row index of the field within the form (row[“id”] or row number if row[“id”] is not present).
- aio_id
- Returns:
- classmethod field_div(aio_id: str | Wildcard, field_type: str | Wildcard, field_id: str | Wildcard, row_index: str | int | Wildcard) dict[str, Any]#
Return the id for an input form field div.
- Parameters:
- aio_id
stror_Wildcard The component’s unique identifier.
- field_type
str,or_Wildcard The unique type of the field within the form (field[“type”]).
- field_id
str,or_Wildcard The unique identifier of the field within the form (field[“id”]).
- row_index
str,int,or_Wildcard The unique row index of the field within the form (row[“id”] or row number if row[“id”] is not present).
- aio_id
- Returns:
- classmethod help(aio_id: str | Wildcard, row_index: str | int | Wildcard) dict[str, Any]#
Return the id for an input form help text.
- classmethod label(aio_id: str | Wildcard, row_index: str | int | Wildcard) dict[str, Any]#
Return the id for an input form label.
- classmethod modal(aio_id: str | Wildcard, row_index: str | int | Wildcard) dict[str, Any]#
Return the id for an input form modal.