Skip to content

Multi-line TextInput box? #2828

Description

@jbednar

In general I've found it very difficult to find information on Bokeh widgets in the documentation, so maybe this is already possible, but is there a way to specify a paragraph-sized TextInput box? I'm using one for the user to be able to edit some code in a domain-specific language, which is awkward to do in a single-line box.

If multiple lines are not possible, is there at least a way to change the size of the box?

Activity

  1. jbednar commented on Sep 9, 2015

    @jbednar
    ContributorAuthor

    Right now, the TextInput box accepts multi-line strings, but the newlines just show up as spaces, with everything still on one line.

  2. jbednar commented on Sep 9, 2015

    @jbednar
    ContributorAuthor

    It looks like the TextInput box maps to an HTML input object, and I'd need an HTML textarea object in this case.

    One complication is that the input object triggers a re-render based on pressing enter, but textarea would need to use enter internally. But there may be no problem with this, since both of them appear to trigger an update when the widget loses focus.

    Another complication is that a textarea would need some sizing parameters to determine how large to make it. That might be a good reason to make a new type of Bokeh widget for multi-line input, rather than just adding a multiline=True option to TextInput.

  3. jbednar commented on Sep 9, 2015

    @jbednar
    ContributorAuthor

    Actually, needing to press return is an issue. I tested it out by hacking the textinput template to use textarea:

    diff --git a/bokehjs/src/coffee/widget/text_input_template.eco b/bokehjs/src/coffee/widget/text_input_template.eco
    index 48d790c..8d75812 100644
    --- a/bokehjs/src/coffee/widget/text_input_template.eco
    +++ b/bokehjs/src/coffee/widget/text_input_template.eco
    @@ -1,2 +1,2 @@
     <label for="<%= @id %>"> <%= @title %> </label>
    -<input class="bk-widget-form-input" type="text" id="<%=@id %>" name="<%= @name %>" value="<%= @value %>"/>
    +<textarea class="bk-widget-form-input" rows="10" cols="50" id="<%=@id %>" name="<%= @name %>"> <%= @value %> </textarea>
    

    This works in terms of displaying the multi-line text and editing it, but I've defined a CustomJS callback for the textinput widget, and it apparently never gets called now, presumably because enter is now taken literally as a carriage return.

  4. mattpap commented on Sep 10, 2015

    @mattpap
    Contributor

    This has to be implemented as a separate widget, so that we don't mix concerns. I may actually do it as part of custom models work, because this touches some interesting issues.

  5. jbednar commented on Sep 10, 2015

    @jbednar
    ContributorAuthor

    Interesting sounds scary! :-) I'd wished for easy and boring.

  6. modified the milestone: on Sep 11, 2018
  7. EliYk commented on Oct 9, 2018

    @EliYk

    What would be a simple way of adding a multiline text input to a bokeh app?

    (If it's of relevance - it's supposed to accept an SQL query, and display results in a DataTable widget)

    Thanks,
    Eli

  8. added this to the 1.0.3 milestone on Dec 27, 2018
  9. PRATIKSHIRBHATE commented on Feb 9, 2021

    @PRATIKSHIRBHATE

    Hi Team, is this issue fixed?

  10. philippjfr commented on Feb 9, 2021

    @philippjfr
    Contributor

    Yes, there is a TextAreaInput widget.

  11. github-actions commented on Oct 26, 2024

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  12. locked as resolved and limited conversation to collaborators on Oct 26, 2024
  13. added theissue type on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions