Skip to main content

InputDecorationTheme

Customizes the decoration of descendant TextField and Dropdown controls: their border, label, hint and helper styles, padding and fill.

A control's own properties win over the theme. A control with no border uses the theme's border.

Example

A soft resting border that darkens on hover and turns to the primary color on focus:

page.theme = ft.Theme(
input_decoration_theme=ft.InputDecorationTheme(
border=ft.OutlineInputBorder(
border_radius=8,
side=ft.BorderSide(
color=ft.Colors.with_opacity(0.24, ft.Colors.ON_SURFACE)
),
),
label_style=ft.TextStyle(size=14),
hint_style=ft.TextStyle(size=14),
),
)

Properties

Properties​

align_label_with_hintclass-attributeinstance-attribute​

align_label_with_hint: bool | None = None

Whether the label aligns with the hint text in multiline fields, rather than being vertically centered.

borderclass-attributeinstance-attribute​

border: ControlStateValue[InputBorder] | None = None

The border drawn around the decorated input area, for every state.

Accepts a single InputBorder or a dictionary mapping ControlStates to InputBorders. Supported state keys are DEFAULT, HOVERED, FOCUSED, ERROR and DISABLED.

The DEFAULT entry (or the single border) sets the shape for all states and the line for the resting state only. Each other state uses the side of its own entry if given, otherwise the Material default for that state - so setting only a soft resting color keeps the darker hover line and the primary-colored, thicker focus line.

content_paddingclass-attributeinstance-attribute​

content_padding: PaddingValue | None = None

The padding around the input text and label.

counter_styleclass-attributeinstance-attribute​

counter_style: TextStyle | None = None

The style of the counter text.

denseclass-attributeinstance-attribute​

dense: bool | None = None

Whether fields use less vertical space.

error_styleclass-attributeinstance-attribute​

error_style: TextStyle | None = None

The style of the error text.

fill_colorclass-attributeinstance-attribute​

fill_color: ColorValue | None = None

The fill color of filled fields.

filledclass-attributeinstance-attribute​

filled: bool | None = None

Whether fields are filled with fill_color.

floating_label_styleclass-attributeinstance-attribute​

floating_label_style: TextStyle | None = None

The style of the label when it floats above the field.

focus_colorclass-attributeinstance-attribute​

focus_color: ColorValue | None = None

The fill color of filled fields while focused.

helper_styleclass-attributeinstance-attribute​

helper_style: TextStyle | None = None

The style of the helper text.

hint_styleclass-attributeinstance-attribute​

hint_style: TextStyle | None = None

The style of the hint text.

hover_colorclass-attributeinstance-attribute​

hover_color: ColorValue | None = None

The fill color of filled fields while hovered.

icon_colorclass-attributeinstance-attribute​

icon_color: ColorValue | None = None

The color of the icon in front of the field.

label_styleclass-attributeinstance-attribute​

label_style: TextStyle | None = None

The style of the label when it sits inside the field.

prefix_icon_colorclass-attributeinstance-attribute​

prefix_icon_color: ColorValue | None = None

The color of the prefix icon.

prefix_styleclass-attributeinstance-attribute​

prefix_style: TextStyle | None = None

The style of the prefix text.

size_constraintsclass-attributeinstance-attribute​

size_constraints: BoxConstraints | None = None

The size constraints of the decorated input area.

suffix_icon_colorclass-attributeinstance-attribute​

suffix_icon_color: ColorValue | None = None

The color of the suffix icon.

suffix_styleclass-attributeinstance-attribute​

suffix_style: TextStyle | None = None

The style of the suffix text.