diff --git a/docs/DataTable.md b/docs/DataTable.md index a1cf42ef80c..8763f77e349 100644 --- a/docs/DataTable.md +++ b/docs/DataTable.md @@ -691,6 +691,33 @@ const PostList = () => ( **Tip**: To handle sorting in your custom DataTable head component, check out the [Building a custom sort control](./ListTutorial.md#building-a-custom-sort-control) section. +## `hiddenColumns` + +By default, `` renders all `` children. Use the `hiddenColumns` property to set hidden columns by default. + +```tsx +import { ColumnsButton, TopToolbar, List, DataTable } from 'react-admin'; + +const PostListActions = () => ( + + + +) + +const PostList = () => ( + }> + + + + + + + +); +``` + +Using the `hiddenColumns` property instead of removing `` elements entirely allows hidden columns to be displayed again using a `ColumnsButton`, as explained in the [Hiding or Reordering Columns](#hiding-or-reordering-columns) section. + ## `hover` By default, when a user hovers over a row, the background color changes to indicate the row is active. Set the `hover` prop to `false` to disable this behavior.