Skip to main content

BnText

Namespace: BlazorNative.Components

A text label. Renders as a native TextView on Android and a UILabel on iOS.

public sealed class BnText : Microsoft.AspNetCore.Components.ComponentBase, Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleEvent, Microsoft.AspNetCore.Components.IHandleAfterRender

Inheritance ObjectComponentBaseBnText
Implements IComponent, IHandleEvent, IHandleAfterRender
Attributes NullableContextAttribute, NullableAttribute

Remarks:

The platform measures it, not the layout engine: a label with no explicit size reports the height its text actually wraps to, and that measured height is what the surrounding flex layout is given. Constrain the width — with BnView.Width on a wrapper, or by letting a row size it — and the text wraps inside it.

Properties

Text

The text to show. Null renders an empty label rather than nothing, so the label keeps its place in the layout.

public string? Text { get; set; }

Property Value

String

FontSize

Font size in density-independent units — 24 is 24dp on Android and 24pt on iOS. Null leaves the platform's default label size.

public float? FontSize { get; set; }

Property Value

Single?

Constructors

BnText()

public BnText()