diff --git a/src-docs/src/views/datagrid/_snippets.tsx b/src-docs/src/views/datagrid/_snippets.tsx
index 66f82019fcd..672e1417364 100644
--- a/src-docs/src/views/datagrid/_snippets.tsx
+++ b/src-docs/src/views/datagrid/_snippets.tsx
@@ -11,6 +11,7 @@ inMemory={{ level: 'sorting' }}`,
id: 'A', // required
display: <>Column A >, // optional column header rendering
displayAsText: 'Column A', // column header as plain text
+ displayHeaderCellProps: { className: 'eui-textCenter' }, // optional column header cell props
initialWidth: 150, // starting width of 150px
isResizable: false, // prevents the user from resizing width
isExpandable: false, // doesn't allow clicking in to see the content in a popup
@@ -33,16 +34,22 @@ inMemory={{ level: 'sorting' }}`,
{
id: 'selection',
width: 31,
- headerCellRender: () => Select a Row,
+ headerCellRender: () => Select a row,
+ headerCellProps: { className: 'eui-textCenter' },
rowCellRender: () =>
,
+ footerCellRender: () => Select a row,
+ footerCellProps: { className: 'eui-textCenter' },
},
]}`,
trailingControlColumns: `trailingControlColumns={[
{
id: 'actions',
width: 40,
- headerCellRender: () => null,
+ headerCellRender: () => 'Actions',
+ headerCellProps: { className: 'euiScreenReaderOnly' },
rowCellRender: MyGridActionsComponent,
+ footerCellRender: () => null,
+ footerCellProps: { data-test-subj: 'emptyFooterCell' },
},
]}`,
renderCellValue: 'renderCellValue={({ rowIndex, columnId }) => {}}',
diff --git a/src-docs/src/views/datagrid/schema_columns/datagrid_columns_example.js b/src-docs/src/views/datagrid/schema_columns/datagrid_columns_example.js
index ef65697d7fe..6119176f991 100644
--- a/src-docs/src/views/datagrid/schema_columns/datagrid_columns_example.js
+++ b/src-docs/src/views/datagrid/schema_columns/datagrid_columns_example.js
@@ -293,8 +293,7 @@ schemaDetectors={[
The footer row is defined by passing{' '}
renderFooterCellValue function prop into{' '}
- EuiDataGrid.{' '}
- renderFooterCellValue acts like a React
+ EuiDataGrid. This function acts like a React
component, receiving{' '}
EuiDataGridCellValueElementProps and returning a
React node.
@@ -304,6 +303,10 @@ schemaDetectors={[
expansion on cells without content with{' '}
setCellProps({'{ isExpandable: false }'}).
+
+ Control columns will render empty footer cells by default, unless a
+ custom footerCellRender function is passed.
+
),
props: {
diff --git a/src-docs/src/views/datagrid/schema_columns/footer_row.js b/src-docs/src/views/datagrid/schema_columns/footer_row.js
index cda16af202b..8a92932cf71 100644
--- a/src-docs/src/views/datagrid/schema_columns/footer_row.js
+++ b/src-docs/src/views/datagrid/schema_columns/footer_row.js
@@ -3,6 +3,8 @@ import { faker } from '@faker-js/faker';
import {
EuiDataGrid,
+ EuiCheckbox,
+ EuiButtonIcon,
EuiSwitch,
EuiFlexGroup,
EuiFlexItem,
@@ -14,7 +16,7 @@ for (let i = 1; i < 20; i++) {
raw_data.push({
name: `${faker.name.lastName()}, ${faker.name.firstName()} ${faker.name.suffix()}`,
date: `${faker.date.past()}`,
- amount: faker.commerce.price(),
+ amount: `$${faker.commerce.price()}`,
phone: faker.phone.number(),
version: faker.system.semver(),
});
@@ -65,6 +67,47 @@ const columns = [
},
];
+const leadingControlColumns = [
+ {
+ id: 'selection',
+ width: 32,
+ // Check state doesn't actually work - this is just a static example
+ headerCellRender: () => (
+