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:
Selection and filtering
Custom table implementations must completely handle their own selection and filtering.
Mobile headers
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.
Cell text behavior
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 "fixed" | "auto" | Default value fixed |
Prop hasBackground# | Description and type Toggle the table's background boolean | Default value true |
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 |
EuiTableFooterCell
Prop | Description and type | Default value |
|---|---|---|
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
EuiTableHeader
Prop | Description and type | Default value |
|---|---|---|
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. 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 children# | Description and type Children must be valid DOM structure residing within ReactNode |