Skip to content

Commit 2a57294

Browse files
authored
Merge pull request #9220 from marmelab/doc-list-actions-error
[Doc] Fix `<List actions>` example throws an error
2 parents 33bfca4 + e526918 commit 2a57294

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/List.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@ const ListActions = () => (
110110
</TopToolbar>
111111
);
112112

113+
const postFilters = [
114+
<TextInput label="Search" source="q" alwaysOn />,
115+
<TextInput label="Title" source="title" defaultValue="Hello, World!" />,
116+
];
117+
113118
export const PostList = () => (
114-
<List actions={<ListActions/>}>
119+
<List actions={<ListActions/>} filters={postFilters}>
115120
<DatagridConfigurable>
116121
...
117122
</DatagridConfigurable>

packages/ra-ui-materialui/src/list/filter/FilterButton.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ export const FilterButton = (props: FilterButtonProps): JSX.Element => {
5757
const anchorEl = useRef();
5858

5959
if (filters === undefined) {
60-
throw new Error('FilterButton requires filters prop to be set');
60+
throw new Error(
61+
'The <FilterButton> component requires the <List filters> prop to be set'
62+
);
6163
}
6264

6365
const hiddenFilters = filters.filter(

0 commit comments

Comments
 (0)