Class RadzenText
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.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenText : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
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
RadzenText()
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()
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>
Properties
Anchor
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
[Parameter]
public string Anchor { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The anchor identifier for heading links. |
ChildContent
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
[Parameter]
public RenderFragment ChildContent { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderFragment | The child content render fragment. |
TagName
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
[Parameter]
public TagName TagName { get; set; }
Property Value
| Type | Description |
|---|---|
| TagName | The HTML tag name. Default is Auto. |
Text
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
[Parameter]
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The text content to display. |
TextAlign
Gets or sets the horizontal text alignment within the container. Options include Left, Right, Center, Justify, Start, End, and JustifyAll.
Declaration
[Parameter]
public TextAlign TextAlign { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlign | The text alignment. Default is Left. |
TextStyle
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
[Parameter]
public TextStyle TextStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| TextStyle | The text style. Default is Body1. |
Methods
BuildRenderTree(RenderTreeBuilder)
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
protected override void BuildRenderTree(RenderTreeBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | builder |