Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiBasicTable/Flex layouts] Support for multi line truncation. #7226

Closed
walterra opened this issue Sep 26, 2023 · 3 comments · Fixed by #7254
Closed

[EuiBasicTable/Flex layouts] Support for multi line truncation. #7226

walterra opened this issue Sep 26, 2023 · 3 comments · Fixed by #7254
Assignees

Comments

@walterra
Copy link
Contributor

At the moment EUI table columns support truncateText which works great for single lines. An additional option to support multi-line truncation would be great. There's some prior art spread across in Kibana with custom code which looks like there are use cases for both table columns and flex layouts.

Here's an example for custom code for a column's render function for EuiBasicTable using -webkit-line-clamp to achieve multi-line truncation.

    {
      field: 'myField',
      name:'My field',
      render: (value) => {
        return (
          <div
            css={css`
              display: -webkit-box;
              line-clamp: 3;
              -webkit-line-clamp: 3;
              -webkit-box-orient: vertical;
              overflow: hidden;
            `}
          >
            {value}
          </div>
        );
      },
      truncateText: false,
      valign: 'middle',
    },
@1Copenut
Copy link
Contributor

Thank you for the submission @walterra. The EUI team will triage this in our weekly Monday backlog meeting.

@cee-chen cee-chen self-assigned this Oct 2, 2023
@cee-chen
Copy link
Member

cee-chen commented Oct 4, 2023

@walterra Just curious, any preference on the API/name? Here's what I currently have:

<EuiBasicTable
  columns={[
    {
      field: 'myField',
      name: 'My field',
      truncateText: { lines: 2 },
      valign: 'middle',
    }
  ]}
/>

For contrast, EuiDataGrid uses lineCount:

<EuiDataGrid
  rowHeightsOptions={{
    defaultHeight: { lineCount: 2 },
  }}
/>

@walterra
Copy link
Contributor Author

walterra commented Oct 4, 2023

Thanks for looking into this! Don't have a strong preference, but maybe good to keep in sync with data grid.

walterra added a commit to elastic/kibana that referenced this issue Oct 30, 2023
…sts (#169830)

Makes use of EUI's new multi-line truncation option for table columns
(elastic/eui#7226). For columns that use this
feature, this PR wraps the text in custom render functions which add a
`span` element with a `title` attribute and the cells text.
fkanout pushed a commit to fkanout/kibana that referenced this issue Oct 30, 2023
…sts (elastic#169830)

Makes use of EUI's new multi-line truncation option for table columns
(elastic/eui#7226). For columns that use this
feature, this PR wraps the text in custom render functions which add a
`span` element with a `title` attribute and the cells text.
bryce-b pushed a commit to bryce-b/kibana that referenced this issue Oct 30, 2023
…sts (elastic#169830)

Makes use of EUI's new multi-line truncation option for table columns
(elastic/eui#7226). For columns that use this
feature, this PR wraps the text in custom render functions which add a
`span` element with a `title` attribute and the cells text.
awahab07 pushed a commit to awahab07/kibana that referenced this issue Oct 31, 2023
…sts (elastic#169830)

Makes use of EUI's new multi-line truncation option for table columns
(elastic/eui#7226). For columns that use this
feature, this PR wraps the text in custom render functions which add a
`span` element with a `title` attribute and the cells text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants