bootstack.FieldItem#

class bootstack.FieldItem(key, label=None, dtype=None, readonly=False, required=False, visible=True, column=None, row=None, columnspan=1, rowspan=1, editor=None, editor_options=<factory>, type='field')#

Bases: object

A single field in a Form, addressed by its key.

column: int | None = None#

Zero-based grid column. Auto-placed when None.

columnspan: int = 1#

Number of grid columns to span. Default 1.

dtype: DType = None#

Type hint controlling the default editor — 'str', 'int', 'float', 'bool', 'date', 'datetime', or 'password'. None infers the type from the initial value.

editor: EditorType | None = None#

Force a specific editor widget (see EditorType). None infers it from dtype.

editor_options: dict[str, Any]#

Extra keyword arguments forwarded to the editor widget. For 'select', pass {"values": ["A", "B", "C"]}; add {"allow_custom_values": True} for an editable combobox.

key: str#

Unique field identifier — used to read and write the field value.

label: str | None = None#

Display label shown above the field. Defaults to the capitalized key.

readonly: bool = False#

Render the field read-only. Default False.

required: bool = False#

Mark the field as required — adds a 'required' validation rule and appends an asterisk to the label. Honored by the text, number, password, date, and select editors; has no effect on boolean or slider editors. Default False.

row: int | None = None#

Zero-based grid row. Auto-placed when None.

rowspan: int = 1#

Number of grid rows to span. Default 1.

type: Literal['field'] = 'field'#

Item-type discriminator. Set automatically; only needed when building items as plain dicts.

visible: bool = True#

Show the field. Set False to hide it. Default True.