Skip to content
On this page

TextField

Text fields let users enter text into a UI.

  • Make sure text fields look interactive
  • Two types: filled and outlined
  • The text field’s state (blank, with input, error, etc) should be visible at a glance
  • Keep labels and error messages brief and easy to act on
  • Text fields commonly appear in forms and dialogs

Examples

xml
<md:TextField
    IconData="{Static icon:Material.Search}"
    Style="{DynamicResource FilledTextFieldStyle}"
    WidthRequest="250" />

<md:TextField
    IconData="{Static icon:Material.Password}"
    Style="{DynamicResource OutlinedTextFieldStyle}"
    SupportingText="Incorrect password"
    TrailingIconData="{Static icon:Material.Close}"
    WidthRequest="300" />

Properties

nametypedefault
InputTypeInputTypeNone
Textstringempty
FontColorColorstyle
FontSizefloat16
FontFamilystring
FontWeightFontWeightRegular
FontIsItalicboolfalse
CaretColorColorstyle
SelectionRangeTextRange0
TextAlignmentTextAlignmentStart
IconDatastring
IconColorColorOnSurfaceVariantColor
TrailingIconDatastring
TrailingIconColorColorOnSurfaceVariantColor
ActiveIndicatorHeightint
ActiveIndicatorColorColorOnSurfaceVariantColor
LabelTextstring
LabelFontColorColorOnSurfaceVariantColor
SupportingTextstring
SupportingFontColorColorOnSurfaceVariantColor
BackgroundColorColorSurfaceContainerHighestColor
ShapeShapeExtraSmallTop
StateLayerColorColorOnSurfaceVariantColor

Events

nametype
TextChangedEventHandler<TextChangedEventArgs>
TrailingIconClickedEventHandler<EventArgs>
ClickedEventHandler<TouchEventArgs>
PressedEventHandler<TouchEventArgs>
ReleasedEventHandler<TouchEventArgs>
LongPressedEventHandler<TouchEventArgs>
RightClicked ( desktop only )EventHandler<TouchEventArgs>