panel.chat.input module#

class panel.chat.input.ChatAreaInput(**params: Any)[source]#

Bases: TextAreaInput

The ChatAreaInput allows entering any multiline string using a text input box, with the ability to press enter to submit the message.

Unlike TextAreaInput, the ChatAreaInput defaults to auto_grow=True and max_rows=10, and the value is not synced to the server until the enter key is pressed so bind on value_input if you need to access the existing value.

Lines are joined with the newline character n.

Reference: https://panel.holoviz.org/reference/chat/ChatAreaInput.html

Example:

>>> ChatAreaInput(max_rows=10)

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.widgets.base.Widget: height, margin, disabled

panel.widgets.input._TextInputBase: value, width, description, placeholder, value_input

panel.widgets.input.TextAreaInput: cols

max_length = Integer(default=50000, inclusive_bounds=(True, True), label='Max length')

Max count of characters in the input field.

auto_grow = Boolean(default=True, label='Auto grow')

Whether the text area should automatically grow vertically to accommodate the current text.

max_rows = Integer(default=10, inclusive_bounds=(True, True), label='Max rows')

When combined with auto_grow this determines the maximum number of rows the input area can grow.

rows = Integer(default=1, inclusive_bounds=(True, True), label='Rows')

Number of rows in the text input field.

resizable = Selector(default='height', label='Resizable', names={}, objects=['both', 'width', 'height', False])

Whether the layout is interactively resizable, and if so in which dimensions: width, height, or both. Can only be set during initialization.

disabled_enter = Boolean(default=False, label='Disabled enter')

If True, disables sending the message by pressing the enter_sends key.

enter_sends = Boolean(default=True, label='Enter sends')

If True, pressing the Enter key sends the message, if False it is sent by pressing the Ctrl+Enter.

enter_pressed = Event(default=False, label='Enter pressed')

Event when the Enter/Ctrl+Enter key has been pressed.