We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Right-Align Text within the TextBox

Thread ID:

Created:

Updated:

Platform:

Replies:

149933 Dec 15,2019 10:28 AM UTC Dec 17,2019 09:24 AM UTC Blazor 3
loading
Tags: TextBox
Matthew
Asked On December 15, 2019 10:28 AM UTC

Hi Have tries getting text to be right-aligned within a textbox by using the HTML attributes feature, however, what happens is that my float label on the textbox get right aligned instead of the text within the textbox

<EjsTextBox Readonly="true" Placeholder="Total Charge" HtmlAttributes="@RightAlignTextbox" FloatLabelType="FloatLabelType.Always" Value="100.00"></EjsTextBox>

@code {
    private Dictionary<string, object> RightAlignTextbox { get; set; } = new Dictionary<string, object>() { { "style", "text-align: right;" } };
}

Any way around this? Perhaps I can request a text alignment parameter for the TextBox control? :)

Saranya Dhayalan [Syncfusion]
Replied On December 16, 2019 05:48 AM UTC

 
Thank you for contacting Syncfusion support, 
 
We have checked your code snippet, we can achieve this by using CssClass property. By providing HtmlAtribute only root element is right aligned. Please find the below code snippet: 
@using Syncfusion.EJ2.Blazor.Inputs 
 
<EjsTextBox Readonly="true" CssClass="custom-class" Placeholder="Total Charge" HtmlAttributes="@RightAlignTextbox" FloatLabelType="FloatLabelType.Always" Value="100.00"></EjsTextBox> 
 
@code { 
    private Dictionary<string, object> RightAlignTextbox { get; set; } = new Dictionary<string, object>() { { "style", "text-align: right;" } }; 
} 
<style> 
     .custom-class.e-control-wrapper .e-textbox { 
        text-align:right; 
    } 
</style> 
 
Please find the below API link: 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Saranya D 


Matthew
Replied On December 16, 2019 07:11 PM UTC

Hi,

That has worked perfectly for me, thank you for your assistance.

I am aware of the CssClass property for controls, the main issue I find with creating custom styles and applying them is that I cannot easily find any documentation to know which  css class names to extend. For example, in your solution, you have shown me that I need to extend ".e-control-wrapper .e-textbox", it would be nice if for each control you could add documentation to extend and override different parts of the rendered control css, at least for people like me who are not css experts.

Thanks

Saranya Dhayalan [Syncfusion]
Replied On December 17, 2019 09:24 AM UTC

Hi Matthew, 
 
Welcome, 
 
We have checked your query and we will update this in our documentation site. This will be available in our upcoming release. We appreciate your patience until then. 
 
Regards, 
Saranya D 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon