Custom tables
If you need more custom behavior than either
EuiBasicTable or EuiInMemoryTable allow, you can opt to completely construct your own table from EUI's low-level table building block components, like EuiTableHeader and EuiTableRowCell.There are several important caveats to keep in mind while doing so:
Custom table implementations must completely handle their own selection and filtering.
You must supply a
mobileOptions.header
prop equivalent to the column header on each EuiTableRowCell so that the mobile version will use that to populate the per cell headers.Also, in order to add mobile support for selection and filtering toolbars, you will need to implement the EuiTableHeaderMobile component as a wrapper around these and use EuiTableSortMobile and EuiTableSortMobileItem components to supply mobile sorting. See demo below.
Set individual props like the truncateText
prop to cells to enforce a single-line behavior and truncate their contents, or set the textOnly
prop to false
if you need the contents to be a direct descendent of the cell.
Below is one of many ways you might set up a custom table that account for all the above notes:
Props
EuiTable
Prop | Description and type | Default value |
---|---|---|
Prop compressed# | Description and type Type: boolean | Default value |
Prop responsiveBreakpoint# | Description and type Named breakpoint. Below this size, the table will collapse Pass string | boolean | Default value m |
Prop tableLayout# | Description and type Sets the table-layout CSS property "auto" | "fixed" | Default value fixed |
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Type: string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
EuiTableBody
Prop | Description and type | Default value |
---|---|---|
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Type: string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop bodyRef# | Description and type Type: Ref<HTMLTableSectionElement> | Default value |
EuiTableFooter
Prop | Description and type | Default value |
---|---|---|
Prop className# | Description and type Type: string | Default value |