Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Vertical Overflow and Cells with Constrained Height #737

@chriddyp

Description

@chriddyp

In some cases, text can be very long within a cell and a user may wish to constrain the height of the cell.

This currently requires a css= workaround. It would be nice if it didn't.

From the docs, this is:

dash_table.DataTable(
    style_data={
        'whiteSpace': 'normal',
    },
    data=df_moby_dick.to_dict('records'),
    columns=[{'id': c, 'name': c} for c in df_moby_dick.columns],
    css=[{
        'selector': '.dash-spreadsheet td div',
        'rule': '''
            line-height: 15px;
            max-height: 30px; min-height: 30px; height: 30px;
            display: block;
            overflow-y: hidden;
        '''
    }],
    tooltip_data=[
        {
            column: {'value': str(value), 'type': 'markdown'}
            for column, value in row.items()
        } for row in df_moby_dick.to_dict('rows')
    ],
    tooltip_duration=None
)

Let's comment on this issue if we change this example and/or provide an alternative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions