You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/FilterList.md
+45-111
Original file line number
Diff line number
Diff line change
@@ -5,130 +5,64 @@ title: "The FilterList Component"
5
5
6
6
# `<FilterList>`
7
7
8
+
An alternative UI to the Filter Button/Form Combo is the FilterList Sidebar. Similar to what users usually see on e-commerce websites, it's a panel with many simple filters that can be enabled and combined using the mouse.
9
+
8
10

9
11
10
-
An alternative UI to the Filter Button/Form Combo is the FilterList Sidebar. Similar to what users usually see on e-commerce websites, it's a panel with many simple filters that can be enabled and combined using the mouse. The user experience is better than the Button/Form Combo, because the filter values are explicit, and it doesn't require typing anything in a form. But it's a bit less powerful, as only filters with a finite set of values (or intervals) can be used in the `<FilterList>`.
12
+
The user experience is better than the Button/Form Combo, because the filter values are explicit, and it doesn't require typing anything in a form. But it's a bit less powerful, as only filters with a finite set of values (or intervals) can be used in the `<FilterList>`.
11
13
12
14
## Usage
13
15
14
-
The `<FilterList>` component expects a list of `<FilterListItem>` as children. Each `<FilterListItem>` defines a filter `label` and a `value`, which is merged with the current filter value when enabled by the user. Here is an example usage for a list of customers:
16
+
Use the `<FilterList>` component in a sidebar for the `<List>` view. It expects a list of `<FilterListItem>` as children. Each `<FilterListItem>` defines a filter `label` and a `value`, which is merged with the current filter value when enabled by the user.
17
+
18
+
For instance, here is a filter sidebar for a post list, allowing users to filter on two fields:
**Tip**: The `<Card sx>` prop in the `PostFilterSidebar` component above is here to put the sidebar on the left side of the screen, instead of the default right side.
61
+
62
+
A more sophisticated example is the filter sidebar for the visitors list visible in the screencast at the beginning of this page. The code for this example is available in the [react-admin repository](https://github.com/marmelab/react-admin/blob/master/examples/demo/src/visitors/VisitorListAside.tsx).
63
+
64
+
**Tip**: In a Filter List sidebar, you can use [the `<FilterLiveSearch>` component](./FilterLiveSearch.md) to add a search input at the top of the sidebar, and [the `<SavedQueriesList>` component](./SavedQueriesList.md) to add a list of saved queries.
65
+
132
66
`<FilterList>` accepts 3 props:
133
67
134
68
*[`children`](#children), which must be a list of `<FilterListItem>`
**Tip**: the`<Card sx>` prop in the `PostFilterSidebar` component above is here to put the sidebar on the left side of the screen, instead of the default right side.
206
+
**Tip**: The`<Card sx>` prop in the `PostFilterSidebar` component above is here to put the sidebar on the left side of the screen, instead of the default right side.
207
207
208
208
Check [the `<FilterList>` documentation](./FilterList.md) for more information.
Copy file name to clipboardexpand all lines: docs/SavedQueriesList.md
+2-5
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ title: "The SavedQueriesList Component"
7
7
8
8

9
9
10
-
`<SavedQueriesList>` renders a list of filters saved by the end user (and kept in [the Store](./Store.md)). It is a complement to `<FilterList>` sections for the filter sidebar
10
+
`<SavedQueriesList>` renders a list of filters saved by the end user (and kept in [the Store](./Store.md)). It is a complement to `<FilterList>` sections for [the filter sidebar](./FilteringTutorial.md#the-filterlist-sidebar).
11
11
12
12
## Usage
13
13
@@ -17,7 +17,7 @@ import {
17
17
FilterListItem,
18
18
List,
19
19
Datagrid
20
-
+SavedQueriesList
20
+
+ SavedQueriesList
21
21
} from 'react-admin';
22
22
import { Card, CardContent } from '@mui/material';
0 commit comments