Alignment

Good morning,

How can I get the SfNumericTextBox aligned to the right?

Thanks in advance!

11 Replies 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team October 19, 2020 09:14 AM UTC

Hi Társis, 

Thanks for contacting Syncfusion support. 

We would like to inform you that, we have provided support for RTL NumericTextBox, by setting the EnableRtl property to true. 

<SfNumericTextBox TValue="int?" Value=10 EnableRtl="true"></SfNumericTextBox> 

 
 

Regards, 
Ponmani M 


Marked as answer

KE Kevin November 20, 2021 07:34 PM UTC

I don't think this is the answer he was looking for; what I think he wants and what I want is to justify the number to the right, which is different from rendering it from the right which is necessary for some languages, but not western languages.  It is customary to align the number to the right so that the decimal points line up.  I've tried, and failed with CSS.  Would you please provide and answer on how to accomplish this with the numeric textbox.  Thanks.




Társis November 21, 2021 03:30 PM UTC

Kevin is right. That's what I need.



DR Deepak Ramakrishnan Syncfusion Team November 22, 2021 07:14 PM UTC

Hi Kevin/Tarsis, 
 
Thanks for providing elaborated details about the requirement. 
 
We have validated the requirement in our end with provided details and found that we can achieve it by overriding the existing style of numeric textbox component. Kindly refer the below highlighted code and sample for your reference. 
 
@using Syncfusion.Blazor.Inputs 
 
<SfNumericTextBox TValue="int?" Value=10></SfNumericTextBox> 
 
<style> 
    /*The below styles is used to render the text in the right*/ 
    .e-input-group input.e-input, .e-input-group.e-control-wrapper input.e-input, .e-input-group textarea.e-input, .e-input-group.e-control-wrapper textarea.e-input { 
        text-align-last: end; 
    } 
 
    /*Below styles set the left margin for the down spin arrow which seprates the icon from the text instead of showing it as sticky*/ 
    .e-input + .e-input-group-icon, .e-input-group .e-input + .e-input-group-icon, .e-input-group.e-control-wrapper .e-input + .e-input-group-icon { 
        margin-left: 10px; 
    } 
</style> 
 
 
 
 
Thanks, 
Deepak R. 



KE Kevin November 23, 2021 03:01 AM UTC

Thank you for the quick reply, and the solution I was looking for.  I'm certainly glad I asked because I am sure I would have never ventured your solution.  I really like the Syncfusion Blazor components, but the most problematic area for me has to do with the clarity of CSS modification of the components.  For example, in this instance, it would seem logical to me to simply have 'text-align:right'. ​Regardless, I very much appreciate that what you provide simply works!




Társis November 23, 2021 12:54 PM UTC

Thank you very much!



DR Deepak Ramakrishnan Syncfusion Team November 23, 2021 02:54 PM UTC

Hi Tarsis/Kevin, 
 
Thanks for the update. 
 
We are glad to hear that your requirement have fulfilled at your end. We are always happy to assist you if you need any further assistance. 
 
Thanks, 
Deepak R. 
 



GB gB-Fr September 18, 2022 08:45 PM UTC

Hello,


I use that, and it works :


<SfNumericTextBox Decimals=0 style="text-align-last:end; margin-right:10px;" ShowSpinButton=false CssClass="e-outline" Placeholder="Some text" FloatLabelType="@FloatLabelType.Always" @bind-Value="@CreateEditEntity.Field"></SfNumericTextBox>


Best,

Gilles



SP Sureshkumar P Syncfusion Team September 19, 2022 09:26 AM UTC

Hi GB-Fr,

Thanks for your update.


Regards,

Sureshkumar P



PP Pablo Pellegrini January 10, 2025 05:14 PM UTC

Hello, I am applying the solution mentioned in this forum, and it works correctly, but when I try to use read-only, the background color does not set properly. Could someone show a way to fix it without losing the 10px margin on the right?


Image_8930_1736529146418


Image_3907_1736529157315



Pablo



PK Priyanka Karthikeyan Syncfusion Team January 14, 2025 10:33 AM UTC

Hi Társis,

 

Thank you for the update. To properly apply a background color to the readonly NumericTextBox while retaining the 10px margin on the right, you can use the following CSS styles. These ensure that the design is visually consistent and the specified styles are applied effectively:

 

​<SfNumericTextBox TValue="decimal?"
                 ShowSpinButton="false"
                 Readonly="true"
                 CssClass="custom-readonly"
                 style="text-align-last:end; margin-right:10px; text-align:right;">
</SfNumericTextBox>
<style>
.custom-readonly.e-input-group.e-control-wrapper {
  background: #e9ecef;
 }
</style>

 

Sample: https://blazorplayground.syncfusion.com/hDrojssJKQliIHnP

 

Regards,

Priyanka K

 


Loader.
Up arrow icon