How to add new line in datatable cell

i m trying to add newline inside dash datatable but failed with with these ways.

1/ markdown presentation desn’t allow user input.

2/ input presentation with css doesn’t change the typed \n to newline, with the preline css.

3/ pressing Enter in presentation doesnt create newline.

may i know is there some ways to create newline in datatable? thanks

2 Likes

hi @testingl
welcome to the community and thank you for your question.

Try this post answer.

2 Likes

hi Adam, I’m afraid he’s trying just to get his users to enter line breaks on the page.

hi @AnnMarieW May I ask if there is any way to type newlines by keyboard or copy and paste?

1 Like

thanks Adam and stu. Yep i m trying to let user input newlines inside a datatable cell. Sorry for not being clear.

Hey @testingl
Just add a wrap class on the tag to add a new line in DataTable Cell

Well, you can wrap overflow content onto multiple lines – and you can find some examples of how to do that in the docs, but I don’t think the user can enter a new line character to break the line at a specified place while entering data in the cell. It operates like an html.Input - and it’s not possible to enter new lines into an Input field like that.

The only workaround I can think of is to use using Textarea, which does support multi-line input. However, then you would have to create an html Table rather than using DataTable because you currently can’t use other components in DataTable cells.

thanks @jordan48, could u provide a small sample plz. I dont quite understand it

thx very much @AnnMarieW. The user doesnt want to create another spearate table though. If something like embeded component could work would be great.

The datatable is great job btw.

1 Like