Skip to main content

InputBorder

Base class for borders drawn around the decorated input area of FormFieldControls. Not intended to be used directly.

See subclasses/implementations:

Methods

  • none - A border that draws nothing around the decoration's container, mirroring Flutter's InputBorder.none.

Methods

nonestaticmethod

none() -> InputBorder

A border that draws nothing around the decoration's container, mirroring Flutter's InputBorder.none.

Examples

Border styles

Input border showcase

play_arrowTry Online
import flet as ft


def main(page: ft.Page):
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.TextField(
label="Outline",
border=ft.OutlineInputBorder(),
hint_text="The default border",
),
ft.TextField(
label="Underline",
border=ft.UnderlineInputBorder(),
hint_text="A line along the bottom edge",
),
ft.TextField(
label="Underline filled",
border=ft.UnderlineInputBorder(),
filled=True,
hint_text="The radius rounds the fill's top corners",
),
ft.TextField(
label="None",
border=ft.InputBorder.none(),
filled=True,
hint_text="Draws no border at all",
),
],
),
),
)


if __name__ == "__main__":
ft.run(main)

Styling and per-state borders

Input border styling

play_arrowTry Online
import flet as ft


def main(page: ft.Page):
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.TextField(
label="Custom outline",
border=ft.OutlineInputBorder(
border_radius=12,
gap_padding=8,
side=ft.BorderSide(width=2, color=ft.Colors.TEAL),
),
),
ft.TextField(
label="Custom underline",
border=ft.UnderlineInputBorder(
border_radius=ft.BorderRadius.only(
top_left=12, top_right=12
),
side=ft.BorderSide(width=3, color=ft.Colors.DEEP_ORANGE),
),
filled=True,
),
ft.TextField(
label="Per-state borders",
hint_text="Focus me",
border={
ft.ControlState.DEFAULT: ft.OutlineInputBorder(
border_radius=20,
side=ft.BorderSide(color=ft.Colors.BLUE_GREY_400),
),
ft.ControlState.FOCUSED: ft.OutlineInputBorder(
border_radius=20,
side=ft.BorderSide(width=3, color=ft.Colors.INDIGO),
),
},
),
ft.TextField(
label="Error border",
error="This value is required",
border={
ft.ControlState.DEFAULT: ft.OutlineInputBorder(),
ft.ControlState.ERROR: ft.UnderlineInputBorder(
side=ft.BorderSide(width=3, color=ft.Colors.PINK),
),
},
),
],
),
),
)


if __name__ == "__main__":
ft.run(main)