- On top of making a cell expandable, you can add more custom actions
- by setting cellActions. This contains functions
- called to render additional buttons in the cell and in the popover
- when expanded. Behind the scenes those are treated as a React
+ In addition to making a cell expandable, you can add more custom
+ actions by setting columns.cellActions. These
+ actions will render as icon buttons in the cell on hover/focus, and
+ render as full buttons in the cell expansion popover. Note that once
+ any cellActions are passed, the cell becomes
+ automatically expandable - this ensures keyboard and screen reader
+ users have access to all cell actions.
+
+
+ columns.cellActions accepts an array of render
+ functions. Behind the scenes, the functions are treated as a React
components allowing hooks, context, and other React concepts to be
- used. The functions receives an argument of type
- EuiDataGridColumnCellActionProps. The icons of these
- actions are displayed on mouse over, and also appear in the popover
- when the cell is expanded. Note that once you've defined the{' '}
- cellAction property, the cell's
- automatically expandable.
+ used. Because different button types are used between the cell and
+ the cell popover, we pass your render function a{' '}
+ Component prop which you must render in order for
+ your cell actions to switch correctly between button icons and
+ buttons.
- Below, the email and city columns provide 1{' '}
+ In the below example, the email and city columns provide 1{' '}
cellAction each, while the country column
provides 2 cellActions.
@@ -95,6 +104,42 @@ export const DataGridCellsExample = {
},
demo: ,
},
+ {
+ title: 'Visible cell actions and cell popovers',
+ text: (
+ <>
+
+ By default, only the first 2 cell actions of a cell will be
+ displayed to the left of the expand action button, and remaining
+ actions will be displayed in the footer of the cell expansion
+ popover.
+
+
+ This number is configurable by setting{' '}
+ columns.visibleCellActions, should you need to
+ display more cell actions immediately. However, we advise caution
+ when increasing this limit - the default is set to ensure cell
+ action buttons do not crowd out content.
+
+
+ The below example shows an increasing number of{' '}
+ cellActions in each column. The third column
+ shows visibleCellActions set to 3, and the fourth
+ column shows excess actions overflowing into the popover.
+