projects/forms/input/autosize.directive.ts
import { CngxAutosize } from '@cngx/forms/input'
Auto-resize textarea based on content.
Signal-first alternative to cdkTextareaAutosize. Measures via the scrollHeight trick and reacts to input events + ResizeObserver for programmatic value changes.
cdkTextareaAutosize
scrollHeight
input
ResizeObserver
<textarea cngxAutosize [minRows]="2" [maxRows]="10" #auto="cngxAutosize"></textarea> <span>Height: {{ auto.height() }}px</span>
https://cngxjs.github.io/cngx/examples/#/forms/input/autosize/basic-autosize https://cngxjs.github.io/cngx/examples/#/forms/input/autosize/min-max-rows
textarea[cngxAutosize]
cngxAutosize
"none"
"border-box"
number | undefined
Maximum number of rows. undefined = unlimited.
undefined
number
Minimum number of rows.
1
Signal
Current computed height in px.
this.heightState.asReadonly()
void
Force recalculation of the textarea height.
[style.overflow-y]
overflowY()
[style.resize]
[style.box-sizing]
(input)
input()
no-iframes