Table of Contents

Class TwText

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Renders text with the theme's neutral text colours and shared typography scale.

public class TwText : TwLayoutComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
Inheritance
TwText
Implements
Inherited Members

Remarks

The element defaults to a span, so the component can sit inside a line of text. Set Element to a paragraph, heading or other semantic element when the text is a block of its own.

The colour comes from NeutralText through Tone, so it follows light and dark mode without retyping gray classes. Set Color to use a semantic colour from the theme instead, or Inherit to keep the colour of the surrounding element.

Constructors

TwText()

Initializes a new instance of the TwText class.

public TwText()

Properties

Color

Gets or sets a semantic colour from the theme, such as Primary.

[Parameter]
public Color? Color { get; set; }

Property Value

Color?

Remarks

Takes precedence over Tone so text can share the colour of a button, link or status.

Size

Gets or sets the size on the theme's font-size scale.

[Parameter]
public TextSize? Size { get; set; }

Property Value

TextSize?

Remarks

Leave it unset to inherit the surrounding font size.

Tone

Gets or sets the neutral colour of the text. Defaults to Default.

[Parameter]
public TextTone Tone { get; set; }

Property Value

TextTone

Remarks

Ignored when Color is set. Use Inherit inside a link, button or other element that already supplies its own colour.

Truncate

Gets or sets whether overflowing text is truncated with an ellipsis.

[Parameter]
public bool Truncate { get; set; }

Property Value

bool

Weight

Gets or sets the weight on the theme's font-weight scale.

[Parameter]
public TextWeight? Weight { get; set; }

Property Value

TextWeight?

Remarks

Leave it unset to inherit the surrounding font weight.

rootClasses

Gets the classes for the rendered element, with Class merged last.

protected override string rootClasses { get; }

Property Value

string