Fabulous API
Documentation
2.0
2.0
  • Welcome
  • Xamarin.Forms
    • AnyView
    • Application
    • Element
    • NavigableElement
    • VisualElement
    • View
    • Controls
      • ActivityIndicator
      • BoxView
      • Button
      • CheckBox
      • DatePicker
      • Editor
      • Entry
      • FormattedLabel
      • ImageButton
      • Image
      • IndicatorView
      • InputView
      • Label
      • Picker
      • ProgressBar
      • RadioButton
      • SearchBar
      • Slider
      • Span
      • Stepper
      • Switch
      • TimePicker
      • WebView
    • Collections
      • CarouselView
      • CollectionView
      • ItemsView
      • ListView
    • Layouts
      • Layout
      • TemplatedView
  • .NET MAUI
    • AnyView
    • Application
    • Element
    • NavigableElement
    • VisualElement
    • View
    • Controls
      • ActivityIndicator
      • BoxView
      • Button
      • CheckBox
      • DatePicker
      • Editor
      • Entry
      • FormattedLabel
      • ImageButton
      • Image
      • IndicatorView
      • InputView
      • Label
      • Picker
      • ProgressBar
      • RadioButton
      • SearchBar
      • Slider
      • Span
      • Stepper
      • Switch
      • TimePicker
      • WebView
    • Collections
      • CarouselView
      • CollectionView
      • ItemsView
      • ListView
    • Layouts
      • Layout
      • TemplatedView
  • Avalonia
    • AnyView
    • Application
    • RenderOptions
    • Animatable
    • StyledElement
    • Transform
    • Visual
    • Layoutable
    • InputElement
    • DragDrop
    • FlyoutBase
    • PopupFlyoutBase
    • Control
    • Decorator
    • TemplatedControl
    • ContentControl
    • Spinner
    • TopLevel
    • TextElement
    • ItemsControl
    • SelectingItemsControl
    • MenuBase
    • WindowBase
    • Styling
      • KeyFrame
      • Animation
      • Transition
      • Style
    • Media
      • Transforms
        • Transform
        • MatrixTransform
        • SkewTransform
        • RotateTransform
        • TranslateTransform
        • ScaleTransform
        • Rotate3DTransform
        • TransformGroup
      • Brushes
        • Brush
        • TileBrush
        • SolidColorBrush
        • VisualBrush
        • ImageBrush
        • DrawingBrush
        • GradientStop
        • GradientBrush
        • ConicGradientBrush
        • LinearGradientBrush
        • RadialGradientBrush
      • PathSegments
        • PathSegment
        • ArcSegment
        • BezierSegment
        • PolyLineSegment
        • QuadraticBezierSegment
        • PathFigure
      • Geometries
        • Geometry
        • LineGeometry
        • EllipseGeometry
        • RectangleGeometry
        • PolylineGeometry
        • PathGeometry
        • CombinedGeometry
        • GeometryGroup
      • DashStyle
      • Pen
      • Drawing
      • Effects
Powered by GitBook
On this page
  • Constructors
  • Properties
  • Shorthand properties
  • Events
  • Usages
Edit on GitHub
  1. Xamarin.Forms
  2. Controls

Label

PreviousInputViewNextPicker

Last updated 1 year ago

Inheritance: -> -> -> Xamarin.Forms documentation: Label /

For details on how the control actually works, please refer to the .

Constructors

Constructors
Description

Label(text: string)

Defines a Label widget with a text

Properties

Properties
Description

characterSpacing(value: float)

Sets the spacing between each character of the text

font(?size: float, ?namedSize: NamedSize, ?attributes: FontAttributes, ?fontFamily: string)

Sets the font

horizontalTextAlignment(value: textAlignment)

Sets the horizontal alignment of the text

lineBreakMode(value: LineBreakMode)

Sets the line break mode

lineHeight(value: float)

Sets the multiplier to apply to the default line height when displaying text

maxLines(value: int)

Sets the maximum number of lines allowed

padding(value: Thickness)

Sets the amount of padding around the text

padding(value: float)

Sets a uniform amount of padding around the text

padding(left: float, top: float, right: float, bottom: float)

Sets the amount of padding around the text

textColor(light: FabColor, ?dark: FabColor)

Sets the text color depending if light or dark mode

textDecoration(value: TextDecorations)

Sets the text decorations (underline, strike, etc) to apply on the text

textTransform(value: TextTransform)

Sets the text transformation (lowercase, uppercase) to apply on the text

textType(value: TextType)

Sets the text type (plain text, HTML)

verticalTextAlignment(value: TextAlignment)

Sets the vertical alignment of the text

reference(value: ViewRef<Label>)

Sets a ViewRef instance to retrieve the Xamarin.Forms.Label instance associated to this widget

Shorthand properties

Properties
Description

centerTextHorizontal()

Center the text horizontally inside the Label. Same as horizontalTextAlignment(TextAlignment.Center)

centerTextVertical()

Center the text vertically inside the Label. Same as verticalTextAlignment(TextAlignment.Center)

Events

None

Usages

Label("Hello World")
    .characterSpacing(1.)
    .font(namedSize = NamedSize.Large, fontFamily = "Arial", attributes = FontAttributes.Bold)
    .horizontalTextAlignment(TextAlignment.Center)
    .lineBreakMode(LineBreakMode.WordWrap)
    .lineHeight(1.5)
    .maxLines(1)
    .padding(10.)
    .textColor(light = Color.Red.ToFabColor(), dark = Color.Blue.ToFabColor())
    .textDecoration(TextDecorations.Underline)
    .textTransform(TextTransform.Lowercase)
    .textType(TextType.Text)
    .verticalTextAlignment(TextAlignment.Center)

Use shorthand properties

Label("Hello World")
    .size(500., 500.)
    .centerTextHorizontal()
    .centerTextVertical()

Get access to the underlying Xamarin.Forms.Label

let labelRef = ViewRef<Label>()

Label("Hello World")
    .reference(labelRef)
Element
NavigableElement
VisualElement
View
API
Guide
Xamarin.Forms documentation