Skip to content

Search

A search box that floats over the map. It has two independent halves — place search (a geocoder) and in-layer feature search — and you can enable either or both.

  • id: search
  • Surfaces: floating
  • Notes: chromeless (the bar is the pop-out; re-click the icon to close) and stayOnMobile-friendly (stays over the map on mobile instead of routing to the sheet)

Place it

floatingWidgets: [
  {
    slot: 'top-left',
    widgets: [{ widgetName: 'search', order: -1, stayOnMobile: true }],
  },
],

order: -1 lifts it above the native zoom control in the same corner; stayOnMobile: true keeps the compact bar over the map on phones.

Configuration — settings.search

search: {
  geocoder: { provider: 'nominatim', limit: 3 },
  layers: [
    { layerId: 'airports', fields: ['name'], labelField: 'name', limit: 3, pointZoom: 12 },
    { layerId: 'power-plants', fields: ['plant_name'], labelField: 'plant_name' },
  ],
  placeholder: 'Search places, airports, or power plants…',
  pointZoom: 14,
  sectionOrder: 'features-first',
},

Top-level fields

Field Type Default Description
geocoder GeocoderConfig none Place-search backend (below). Omit for feature-search only
layers SearchableLayerConfig[] none Which data layers are searchable (below). Omit for place-search only
placeholder string 'Search…' Input placeholder text
pointZoom number 14 Zoom when flying to a point result with no bbox
sectionOrder 'features-first' \| 'places-first' 'features-first' Whether matched layers or the geocoder's "Places" come first
loadingText string 'Searching…' Override for non-English UIs
noResultsText string 'No results.' Override for non-English UIs

Geocoder — search.geocoder

Field Type Default Description
provider 'nominatim' \| 'maptiler' nominatim is keyless (OpenStreetMap; light use only, attribution required). maptiler needs an apiKey
apiKey string Required for maptiler
endpoint string provider default Override the request URL (e.g. a self-hosted Nominatim)
limit number 5 Max place results

Searchable layers — search.layers[]

Only GeoJSON layers can be searched (their features are fetched and searched in full; PMTiles and other tiled types can't be searched client-side and are skipped with a warning).

Field Type Default Description
layerId string A layer id from settings.layers
fields string[] Property names to match against (case-insensitive substring)
labelField string first fields entry Property used as the result label
limit number 8 Max matches for this layer
pointZoom number search-wide Overrides pointZoom for point results from this layer