Row Actions Feature Guide
The Row Actions feature is simply a pre-built Display Column feature that adds a column as a place to store either a row action menu, or other row action buttons.
Using the built-in Row Actions column is optional, as you can just simply create your own display columns, but this feature has some built-in conveniences that make it easy to add row actions to your table.
Relevant Table Options
# | Prop Name | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 | { [key: string]: MRT_ColumnDef<TData> } |
| MRT Display Columns Docs | ||
2 | boolean |
| |||
3 | 'first' | 'last' |
| |||
4 | ({ closeMenu, row, table }) => ReactNode |
| |||
5 | ({ cell, row, table }) => ReactNode |
| |||
Enable Row Actions
You can enable the row actions feature by setting the enableRowActions
prop to true
.
You can then add your row action components with either the renderRowActions
or renderRowActionMenuItems
props.
Add Row Actions Menu Items
If you want to embed all of your row actions into a single menu, then you can use the renderRowActionMenuItems
prop.
Actions | First Name | Last Name | Address | City | State |
---|---|---|---|---|---|
Dylan | Murray | 261 Erdman Ford | East Daphne | Kentucky | |
Raquel | Kohler | 769 Dominic Grove | Columbus | Ohio | |
Ervin | Reinger | 566 Brakus Inlet | South Linda | West Virginia | |
Brittany | McCullough | 722 Emie Stream | Lincoln | Nebraska | |
Branson | Frami | 32188 Larkin Turnpike | Charleston | South Carolina |
Add Row Action Buttons
If you want to add row action buttons, then you can use the renderRowActions
prop.
Actions | First Name | Last Name | Address | City | State |
---|---|---|---|---|---|
Dylan | Murray | 261 Erdman Ford | East Daphne | Kentucky | |
Raquel | Kohler | 769 Dominic Grove | Columbus | Ohio | |
Ervin | Reinger | 566 Brakus Inlet | South Linda | West Virginia | |
Brittany | McCullough | 722 Emie Stream | Lincoln | Nebraska | |
Branson | Frami | 32188 Larkin Turnpike | Charleston | South Carolina |
Customize Row Actions Column
Change Row Actions Display Column Options
You can customize all column def options for the row actions column, including the column width, header text, and more using the displayColumnDefOptions
prop.
Position Row Actions Column
You can position the row actions column to the left or right (first or last column) of the table using the positionActionsColumn
prop. The default is as the first column.