Is there a way to adjust the rows of TextBox.

I tried overriding the CSS to adjust the height of the textbox with multiline="true" but seems not the right way to do.
Do you have a way to adjust the row just like the textarea?

11 Replies 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team July 21, 2020 09:18 AM UTC

Hi J, 

Greetings from Syncfusion support. 

No, we couldn’t adjust the height of the Textbox control. Instead we have provided the Multiline support in textbox control using that you can adjust the height of the Textbox as like below code snippet. 

[Index.razor] 

<SfTextBox Multiline="true" Placeholder="Enter the Name" HtmlAttributes="@htmlAttribute"></SfTextBox> 
 
@code{ 
 
    private Dictionary<string, object> htmlAttribute = new Dictionary<string, object>() 
    { 
        {"rows", "5" } 
    }; 
 
} 

Please find the sample from the below link.   


Kindly check with the above sample. Please get back us, if you need further assistance. 

Regards, 
Ponmani M

Marked as answer

J j July 21, 2020 01:35 PM UTC

Thank you.


PM Ponmani Murugaiyan Syncfusion Team July 22, 2020 06:40 AM UTC

Hi J, 
 
Thanks for the update.  
 
Please get back us if you need further assistance. 
 
Regards 
Ponmani M 



MI Mike November 11, 2021 04:50 AM UTC

Adding the attribute directly works too ...

<SfTextBox Rows=5 Multiline="true" Placeholder="Enter the Name"></SfTextBox> 


DR Deepak Ramakrishnan Syncfusion Team November 12, 2021 07:44 AM UTC

Hi Mike, 
 
Thanks for taking your valuable time to sharing us your solution . We are always happy to assist you if you need further assistance on this. 
 
Thanks, 
Deepak R. 



SA Sam August 8, 2024 10:30 AM UTC

Greetings to Syncfusion support. 

I am using SyncFusion.Blazor v26.1.35, I need a textbox with multiline and set number of rows to control of height of component .

I used these 2 ways :

  1. set rows directly in component but I couldn't find rows in list
  2. Untitled.png
  3. set rows with html attributes but it doesn't work
  4. <SfTextBox Width="200px"

               Multiline="true"

               Type="InputType.Text"

               HtmlAttributes="@htmlattribute"  />


    @code {

        Dictionary<string, object> htmlattribute = new Dictionary<string, object>()

        {

            { "maxlength", "256" }, //it works

            { "rows", "3" }, //it doesn't works

        };

    }




PK Priyanka Karthikeyan Syncfusion Team August 9, 2024 01:59 PM UTC

Hi ali,

 

We have tested setting rows for the multiline textbox through HtmlAttributes, and it is working properly on our end. Please find the attached sample for your reference.

 

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

 


 

To assist you better, could you please share the version details you are using? Additionally, we would like to inform you that starting from version 26.1.35, we have implemented a separate TextArea component. For more information, please refer to the following documentation and demos:

 

Regards,

Priyanka K



SA Sam August 11, 2024 06:30 PM UTC

Hi  Priyanka,

Thank you for your quick reply. It was my mistake that I had given height to text box in the app.css file.

I had another question, is there a way to keep its height fixed in multi-line mode?



PK Priyanka Karthikeyan Syncfusion Team August 15, 2024 11:45 AM UTC

Hi J, 


If you want to set a fixed height for the TextBox Multi-line mode, you can do so using the CssClass property. Below is a code snippet and a sample link for your reference:
 

<SfTextBox ID="login" Multiline="true" CssClass="text-multiline" /> 
<style> 
    .text-multiline textarea{ 
        height300px !important; 
    } 
</style> 


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


Could you please check the above code example and let us know whether this is fulfilling your requirement or get back to us if you need further assistance. 


Regards, 

Priyanka K




SA Sam August 15, 2024 08:02 PM UTC

Hi  Priyanka

I ran your example and it was exactly what I was looking for, thank you for your correct and quick answer.



PK Priyanka Karthikeyan Syncfusion Team August 16, 2024 04:08 AM UTC

Hi ali,

Thank you for the update. Please get back to us if you need any further assistance.

Regards,

Priyanka K


Loader.
Up arrow icon