@@ -44,6 +44,10 @@ export const makeVTextareaProps = propsFactory({
4444 default : 5 ,
4545 validator : ( v : any ) => ! isNaN ( parseFloat ( v ) ) ,
4646 } ,
47+ maxHeight : {
48+ type : [ Number , String ] ,
49+ validator : ( v : any ) => ! isNaN ( parseFloat ( v ) ) ,
50+ } ,
4751 maxRows : {
4852 type : [ Number , String ] ,
4953 validator : ( v : any ) => ! isNaN ( parseFloat ( v ) ) ,
@@ -188,7 +192,11 @@ export const VTextarea = genericComponent<VTextareaSlots>()({
188192 parseFloat ( props . rows ) * lineHeight + padding ,
189193 parseFloat ( fieldStyle . getPropertyValue ( '--v-input-control-height' ) )
190194 )
191- const maxHeight = parseFloat ( props . maxRows ! ) * lineHeight + padding || Infinity
195+
196+ const maxHeight = props . maxHeight
197+ ? parseFloat ( props . maxHeight ! )
198+ : parseFloat ( props . maxRows ! ) * lineHeight + padding || Infinity
199+
192200 const newHeight = clamp ( height ?? 0 , minHeight , maxHeight )
193201 rows . value = Math . floor ( ( newHeight - padding ) / lineHeight )
194202
@@ -199,6 +207,7 @@ export const VTextarea = genericComponent<VTextareaSlots>()({
199207 onMounted ( calculateInputHeight )
200208 watch ( model , calculateInputHeight )
201209 watch ( ( ) => props . rows , calculateInputHeight )
210+ watch ( ( ) => props . maxHeight , calculateInputHeight )
202211 watch ( ( ) => props . maxRows , calculateInputHeight )
203212 watch ( ( ) => props . density , calculateInputHeight )
204213 watch ( rows , val => {
@@ -247,6 +256,7 @@ export const VTextarea = genericComponent<VTextareaSlots>()({
247256 ] }
248257 style = { [
249258 {
259+ '--v-textarea-max-height' : props . maxHeight ? convertToUnit ( props . maxHeight ) : undefined ,
250260 '--v-textarea-scroll-bar-width' : convertToUnit ( scrollbarWidth . value ) ,
251261 } ,
252262 props . style ,
0 commit comments