holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.63k stars 504 forks source link

Vertically resize a `TextAreaInput` widget with a minimum height set #5477

Open maximlt opened 1 year ago

maximlt commented 1 year ago

The TextAreaInput widget is based on the Bokeh TextAreaInput widget which has a handle in its bottom-right corner allowing it to be resized manually. IIRC this used not to work at all on Bokeh 2, it's now more useful but I have a use case that is not well supported. I would like to be able to set the minimum height of the widget, have that be the height of the widget when it's initially rendered, and allow users to vertically expand the widget (that's exactly the behavior of the Github comment box I'm writing this message in!).

import panel as pn
pn.extension()

pn.Column(
    '# Title',
    pn.widgets.Select(options=list('abcde')),
    pn.widgets.TextAreaInput(**arguments),
    pn.widgets.Button(name='Submit'),
    styles={'background-color': 'lightgrey'},
).servable()

I can't get the behavior I want passing these different argument variations to the TextAreaInput widget of the little app above:

  1. No arguments: the text area can be resized vertically, but it doesn't have the initial height I want so I'll try more options

  2. With min_height=200: the text area can be resized vertically but it does not initially occupy the whole space available image

  3. With min_height=200, sizing_mode='stretch_height': the text area cannot be resized vertically, it occupies the available height. image


Possibly related to the issue above, I can freely resize the widget horizontally, way beyond the limit of its container.

image

CmpCtrl commented 1 month ago

This seems to still be an issue, and setting resizable=False still allows resizing horizontally outside of the container.