Skip to content

FormFieldControl

Inherits: LayoutControl

Properties

Methods

  • focus

    Request focus for this control.

Properties#

align_label_with_hint class-attribute instance-attribute #

align_label_with_hint: bool | None = None

TBD

bgcolor class-attribute instance-attribute #

bgcolor: ColorValue | None = None

TextField background color.

Note

Will not be visible if filled is False.

border class-attribute instance-attribute #

border: InputBorder = OUTLINE

Border around input.

border_color class-attribute instance-attribute #

border_color: ColorValue | None = None

The border color.

Tip

Set to Colors.TRANSPARENT to invisible/hide the border.

border_radius class-attribute instance-attribute #

border_radius: BorderRadiusValue | None = None

border_width class-attribute instance-attribute #

border_width: Number | None = None

The width of the border in virtual pixels.

Defaults to 1.

Tip

Set to 0 to completely remove the border.

collapsed class-attribute instance-attribute #

collapsed: bool | None = None

TBD

color class-attribute instance-attribute #

color: ColorValue | None = None

Text color.

content_padding class-attribute instance-attribute #

content_padding: PaddingValue | None = None

The padding for the input decoration's container.

counter class-attribute instance-attribute #

counter: StrOrControl | None = None

A Control to place below the line as a character count.

If None or an empty string then nothing will appear in the counter's location.

counter_style class-attribute instance-attribute #

counter_style: TextStyle | None = None

The text style to use for counter.

dense class-attribute instance-attribute #

dense: bool | None = None

Whether this control is part of a dense form (ie, uses less vertical space).

error class-attribute instance-attribute #

error: StrOrControl | None = None

Text that appears below the input border.

If non-null, the border's color animates to red and the helper is not shown.

error_max_lines class-attribute instance-attribute #

error_max_lines: int | None = None

TBD

error_style class-attribute instance-attribute #

error_style: TextStyle | None = None

The text style to use for error.

fill_color class-attribute instance-attribute #

fill_color: ColorValue | None = None

Background color of TextField.

Note

Will not be visible if filled is False.

filled class-attribute instance-attribute #

filled: bool | None = None

If True the decoration's container is filled with theme fill_color.

If filled=None (the default), then it is implicitly set to True when at least one of the following is not None: fill_color, focused_bgcolor, hover_color and bgcolor.

fit_parent_size class-attribute instance-attribute #

fit_parent_size: bool | None = None

TBD

focus_color class-attribute instance-attribute #

focus_color: ColorValue | None = None

TBD

focused_bgcolor class-attribute instance-attribute #

focused_bgcolor: ColorValue | None = None

Background color in focused state.

Note

Will not be visible if filled is False.

focused_border_color class-attribute instance-attribute #

focused_border_color: ColorValue | None = None

Border color in focused state.

focused_border_width class-attribute instance-attribute #

focused_border_width: Number | None = None

Border width in focused state.

focused_color class-attribute instance-attribute #

focused_color: ColorValue | None = None

The text's color when focused.

helper class-attribute instance-attribute #

helper: StrOrControl | None = None

Text that provides context about the input's value, such as how the value will be used.

If non-null, the text is displayed below the input decorator, in the same location as error. If a non-null error value is specified then the helper text is not shown.

helper_max_lines class-attribute instance-attribute #

helper_max_lines: int | None = None

TBD

helper_style class-attribute instance-attribute #

helper_style: TextStyle | None = None

The text style to use for helper.

hint_fade_duration class-attribute instance-attribute #

hint_fade_duration: DurationValue | None = None

TBD

hint_max_lines class-attribute instance-attribute #

hint_max_lines: int | None = None

TBD

hint_style class-attribute instance-attribute #

hint_style: TextStyle | None = None

The text style to use for hint_text.

hint_text class-attribute instance-attribute #

hint_text: str | None = None

Text that suggests what sort of input the field accepts.

Displayed on top of the input when the it's empty and either (a) label is None or (b) the input has the focus.

hover_color class-attribute instance-attribute #

hover_color: ColorValue | None = None

Background color of TextField when hovered.

Note

Will not be visible if filled is False.

icon class-attribute instance-attribute #

icon: IconDataOrControl | None = None

The icon to show before the input field and outside of the decoration's container.

label class-attribute instance-attribute #

label: StrOrControl | None = None

Optional text that describes the input field.

When the input field is empty and unfocused, the label is displayed on top of the input field (i.e., at the same location on the screen where text may be entered in the input field). When the input field receives focus (or if the field is non-empty) the label moves above, either vertically adjacent to, or to the center of the input field.

label_style class-attribute instance-attribute #

label_style: TextStyle | None = None

The text style to use for label.

prefix class-attribute instance-attribute #

prefix: StrOrControl | None = None

A Control to place on the line before the input.

It appears after the prefix_icon, if both are specified.

This can be used, for example, to add some padding to text that would otherwise be specified using prefix, or to add a custom control in front of the input. The control's baseline is lined up with the input baseline.

prefix_icon class-attribute instance-attribute #

prefix_icon: IconDataOrControl | None = None

An icon that appears before the editable part of the text field, within the decoration's container.

If prefix is specified and visible, this icon will appear to its left.

prefix_icon_size_constraints class-attribute instance-attribute #

prefix_icon_size_constraints: BoxConstraints | None = None

TBD

prefix_style class-attribute instance-attribute #

prefix_style: TextStyle | None = None

The text style to use for prefix.

size_constraints class-attribute instance-attribute #

size_constraints: BoxConstraints | None = None

TBD

suffix class-attribute instance-attribute #

suffix: StrOrControl | None = None

A Control to place on the line after the input.

It appears before the suffix_icon, if both are specified.

This can be used, for example, to add some padding to the text that would otherwise be specified using suffix, or to add a custom control after the input. The control's baseline is lined up with the input baseline.

suffix_icon class-attribute instance-attribute #

suffix_icon: IconDataOrControl | None = None

An icon that appears after the editable part of the text field and after the suffix, within the decoration's container.

suffix_icon_size_constraints class-attribute instance-attribute #

suffix_icon_size_constraints: BoxConstraints | None = None

TBD

suffix_style class-attribute instance-attribute #

suffix_style: TextStyle | None = None

The text style to use for suffix.

text_size class-attribute instance-attribute #

text_size: Number | None = None

Text size in virtual pixels.

text_style class-attribute instance-attribute #

text_style: TextStyle | None = None

The TextStyle to use for the text being edited.

text_vertical_align class-attribute instance-attribute #

text_vertical_align: VerticalAlignment | Number | None = (
    None
)

Defines how the text should be aligned vertically.

Value can either be a number ranging from -1.0 (topmost location) to 1.0 (bottommost location) or of type VerticalAlignment Defaults to VerticalAlignment.CENTER.

Methods#

focus async #

focus()

Request focus for this control.

Example
async def main(page: ft.Page):
    page.add(ctf := ft.TextField())
    await ctf.focus()