Search and filters
The list and the map narrowed together: tag filters, nested groups with a checkbox each, a search box, the nearest places first, or only those in view.
Examples
Filter by tagsPlaces with several tags: tick some to see those with all of them.
Filter by groupOffices by region and country, nested in the list, with a checkbox for each region and country.
Search boxA box above the list that narrows the list and the map as you type.
Sort by distanceA button on the map that sorts the list by distance from the visitor.
Search this areaA switch above the list: every place, or only those in view as the map moves.
Map images: © OpenStreetMap contributors, © OpenMapTiles, OpenFreeMap.
Reference
List view options, from the Store reference
| Option | Type | What |
|---|---|---|
as |
"list" | "select" |
A listbox (default) or a native <select> |
groupHeadings |
boolean |
Shows group headings; default true when any location has a group |
groupCounts |
boolean |
After each group heading, how many are listed under it now, following the filter and scope: “North (3)”. Off by default; refused with groupHeadings: false |
fitAll |
boolean |
Adds a first entry to the list, which clears the selection and fits all locations. On a select, the entry shows only while nothing is selected and all locations are fitted; otherwise no option shows, so the entry can be chosen. A map panned under the fit still shows it, and choosing it then does nothing. |
fitAllLabel |
string |
The words of the list’s first entry, which clears the selection and fits all locations; default “All locations”; does nothing without fitAll |
label |
string |
The list’s accessible name; default the heading, else “Locations” |
heading |
string |
A visible heading above the entries |
render |
(entry) => Node |
An entry’s content, for as: "list" only; the view keeps keyboard, focus and ARIA handling |
scope |
"viewport" |
A switch above the list, “All” or “This area”, which lists only the locations in the map’s view and follows it; for as: "list" only |
areaOnlyLabel |
string |
The words of the scope switch’s button that lists only the map’s view; default “This area” |
showAllLabel |
string |
The words of the scope switch’s button that lists every location; default “All” |
emptyAreaLabel |
string |
What a list with scope says when no location is in the map’s view; default “No locations in this area” |
sort |
"distance" |
Once the store has an origin, nearest first, each entry saying how far (Distances) |
distanceUnit |
"kilometer" | "mile" |
What sort writes a distance in; default kilometer |
search |
boolean |
Shows a search box above the entries; for as: "list" only |
searchLabel |
string |
The search box’s placeholder and accessible name; default “Search”; does nothing without search |
noMatchesLabel |
string |
What the line under the search box says when nothing matches; default “No locations match” |
matchesLabel |
string |
What the line under the search box says before the count of matches; default “Locations found”, as “Locations found: 3” |
groupFilter |
boolean |
(1.2) A “Groups” button above the entries that opens a checkbox for each group, subgroups nested (Subgroups); for as: "list" only |
groupFilterLabel |
string |
The boxes’ accessible name; default “Groups”; does nothing without groupFilter |