Comments (3)
@tcbegley, No worries for the delay. Thanks for your considered response!
Yes, I'd noticed that behaviour of input
vs textarea
in the dcc
components, and I understand the hesitation to deviate from the dcc.Textarea
behaviour too. At least for my use case, it is just so much more convenient to have the Enter
to submit and Shift + Enter
for newline (I've tested the pre-release and it works great). For me, that is the behaviour that I expected in the first place from the dcc.Textarea
(I first assumed that it was just a multi-line Input
), and I was disappointed when I found it did not have that.
On the other hand, I can imagine scenarios when you would want Enter
to just be treated as a newline, so there is also an argument for removing the submit on enter from your dbc.Textarea
to allow for that and to re-align with the dcc.Textarea
behaviour.
My vote would be to go ahead with the Enter
for submit and Shift + Enter
for newline. It's intuitive, and very helpful when you do want to use that behaviour.
In the case that someone really doesn't want the additional behaviour, could they just apply bootstrap styling to the dcc.Textarea
, similar to your recommendation for the dcc.Dropdown
? (https://github.com/tcbegley/dash-bootstrap-css)
from dash-bootstrap-components.
This is fixed in the latest release
from dash-bootstrap-components.
Hi @TimChild
Thanks for raising this, and sorry for taking some time getting back to you.
This is an interesting one, it seems the default behaviour for HTML forms is that <textarea>
will not submit, whether or not shift is pressed, enter will always give a new line. By contrast <input>
will submit the form if enter is pressed.
I think your suggestion makes the most sense, shift+enter makes new line, enter by itself submits. My only hesitation is that we would end up diverging slightly from the behaviour of dash-core-components.
I've implemented this change and made it available as a pre-release, I'd be interested to hear how you get on if you have a moment to try it with your app
pip install dash-bootstrap-components==1.5.0rc1
Here's a simple demo app you can try with if you don't have something to hand
import dash_bootstrap_components as dbc
from dash import Dash, html, Input, Output
app = Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container(
[dbc.Textarea(id="textarea", debounce=True), html.P(id="output")],
class_name="p-5",
)
@app.callback(Output("output", "children"), Input("textarea", "value"))
def return_value(value):
return value
if __name__ == "__main__":
app.run_server(debug=True)
from dash-bootstrap-components.
Related Issues (20)
- Support tooltips without IDs HOT 3
- [Bug] Console warning on dbc.Tooltip component HOT 3
- Web site is not showing components HOT 5
- Graphs in tabs example not rendering HOT 2
- Support 'clearable' in Input HOT 1
- Allow not showing up-down arrows in numeric HOT 1
- [BUG] dbc.Modal(style) is passed to fade-modal-show layer instead modal HOT 3
- Consider Supporting Hyperlinks in Carousel Images HOT 6
- Dropdown presentation in data table doesn't work HOT 1
- Keyword argument for value OR placeholder HOT 2
- BUG: max doesn't work on nested progress bar HOT 3
- Docs app not working with Dash 2.14.0 HOT 3
- Allow icons and html in `dbc.AccordionItem()` title HOT 3
- Remove migration guide in docs
- selected attribute for dbc.Select HOT 1
- `dbc.Checklist` does not accept `label` as `list[Component]` like `dcc.Checklist` does HOT 3
- dash_bootstrap_components version versus python version HOT 5
- Nested tabs in `Offcanvas` component trigger scroll up event on tab change HOT 2
- Tooltip closing race condition with children change callback HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash-bootstrap-components.