make it multiline

Hi,

is there a way to use the normal textbox, but that it expands and goes multiline if needed?

thanks in advance

1 Reply

PO Prince Oliver Syncfusion Team October 3, 2018 12:21 PM UTC

Hi Miguel, 

Thank you for contacting Syncfusion support. 

We can achieve your requirement to use textbox in multiline by using an textarea as a CSS component. Kindly refer to the following code snippet. 

let inputEle = document.getElementById('textbox'); 
inputEle.setAttribute('style', 'height:' + (inputEle.scrollHeight) + 'px;overflow-y:hidden;'); 
inputEle.addEventListener("input", OnInput, false); 
 
function OnInput() { 
  this.style.height = 'auto'; 
  this.style.minHeight = '28px'; 
  this.style.height = (this.scrollHeight) + 'px'; 
} 


Please find the sample at the following location: https://stackblitz.com/edit/xsruqs-mcipce 

Regards, 
Prince 


Loader.
Up arrow icon