RadzenText Class

A text display component with predefined typography styles matching Material Design text hierarchy. RadzenText provides consistent text formatting for headings, subtitles, body text, captions, and more with semantic HTML tags. Simplifies typography by providing preset styles that match your theme's design system, allowing consistent, professionally designed text formatting without managing CSS classes manually. Supports text styles (Display headings H1-H6, subtitles, body text, captions, button text, overlines), automatically uses appropriate HTML tags (h1-h6, p, span) based on style, manual HTML tag specification via TagName property, built-in text alignment (left, right, center, justify), and optional anchor links for heading navigation. TextStyle.DisplayH1-H6 provide large display headings, TextStyle.H1-H6 provide standard headings, Subtitle1/2 for subtitles, Body1/2 for paragraphs, Caption for small text, and Overline for labels.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenText

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenText : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

Examples

Heading text:

<RadzenText TextStyle="TextStyle.H3">Welcome to Our Application</RadzenText>

Subtitle with alignment:

<RadzenText TextStyle="TextStyle.Subtitle1" TextAlign="TextAlign.Center">
    This is a centered subtitle
</RadzenText>

Body text with custom tag:

<RadzenText TextStyle="TextStyle.Body1" TagName="TagName.Div">
    This is body text rendered as a div element.
</RadzenText>

Constructors

RadzenTextlink

A text display component with predefined typography styles matching Material Design text hierarchy. RadzenText provides consistent text formatting for headings, subtitles, body text, captions, and more with semantic HTML tags. Simplifies typography by providing preset styles that match your theme's design system, allowing consistent, professionally designed text formatting without managing CSS classes manually. Supports text styles (Display headings H1-H6, subtitles, body text, captions, button text, overlines), automatically uses appropriate HTML tags (h1-h6, p, span) based on style, manual HTML tag specification via TagName property, built-in text alignment (left, right, center, justify), and optional anchor links for heading navigation. TextStyle.DisplayH1-H6 provide large display headings, TextStyle.H1-H6 provide standard headings, Subtitle1/2 for subtitles, Body1/2 for paragraphs, Caption for small text, and Overline for labels.

Declaration
public RadzenText()

Properties

Anchorlink

Gets or sets an anchor identifier for creating linkable headings. When set, adds a clickable link icon next to the text that scrolls to this element when clicked. The anchor href will be the current page URL with #anchorname appended.

Declaration
public string Anchor { get; set; }
Property Value
Type Description
stringGets or sets an anchor identifier for creating linkable headings. When set, adds a clickable link icon next to the text that scrolls to this element when clicked. The anchor href will be the current page URL with #anchorname appended.

ChildContentlink

Gets or sets the child content (markup) to display. Use this for rich content with HTML or other Blazor components. Overridden by Text if both are set.

Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type Description
RenderFragmentGets or sets the child content (markup) to display. Use this for rich content with HTML or other Blazor components. Overridden by Text if both are set.

TagNamelink

Gets or sets the HTML element tag to render. When set to Auto (default), the tag is chosen automatically based on TextStyle (e.g., H1 style uses <h1> tag). Override to use a specific tag regardless of style.

Declaration
public TagName TagName { get; set; }
Property Value
Type Description
TagNameGets or sets the HTML element tag to render. When set to Auto (default), the tag is chosen automatically based on TextStyle (e.g., H1 style uses <h1> tag). Override to use a specific tag regardless of style.

Textlink

Gets or sets the plain text content to display. For simple text display, use this property. For rich content with markup, use ChildContent instead. When set, takes precedence over ChildContent.

Declaration
public string Text { get; set; }
Property Value
Type Description
stringGets or sets the plain text content to display. For simple text display, use this property. For rich content with markup, use ChildContent instead. When set, takes precedence over ChildContent.

TextAlignlink

Gets or sets the horizontal text alignment within the container. Options include Left, Right, Center, Justify, Start, End, and JustifyAll.

Declaration
public TextAlign TextAlign { get; set; }
Property Value
Type Description
TextAlignGets or sets the horizontal text alignment within the container. Options include Left, Right, Center, Justify, Start, End, and JustifyAll.

TextStylelink

Gets or sets the typography style that determines the text size, weight, and appearance. Options include display headings (DisplayH1-H6), standard headings (H1-H6), subtitles, body text, captions, and more. Each style provides consistent formatting matching the theme's design system.

Declaration
public TextStyle TextStyle { get; set; }
Property Value
Type Description
TextStyleGets or sets the typography style that determines the text size, weight, and appearance. Options include display headings (DisplayH1-H6), standard headings (H1-H6), subtitles, body text, captions, and more. Each style provides consistent formatting matching the theme's design system.

Methods

BuildRenderTreelink

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder builder
An error has occurred. This app may no longer respond until reloaded. Reload 🗙