Creating New Line Within Datatable Cell

I have not tried that, but I contacted Plotly support with the same question and received the answer below, which worked for me.

“You can make the datatable cells break when they encounter the \n character by setting the white-space CSS attribute for the cells in the table. E.g you would define your table like below:”

dash_table.DataTable(
 columns=[{"name": i, "id": i, "editable":True} for i in df.columns],
 data=df.to_dict('records'),
 style_cell={
 'whiteSpace': 'pre-line'
 }
)
6 Likes