Get started

Search props

The generated props of every element on Search. The guide is where they are explained; this is every prop.

SearchControl

disabled

boolean

default: false

targets

readonly SearchTargetName[]

The branches to ask for.

language

DataLanguage

The language the Data API answers in.

limit

number

Per-target result cap: a whole number from 1 to 50, the range the API takes.

units

UnitFormatOptions

The units every figure in the list is stated in: an itinerary's length and ascent, and the distance or elevation in the sentence under a place, a way or a point of interest.

A change of its length or its language asks a fresh round, since those sentences are worded as their branch lands.

wording

SearchWording

How a row's title and second line are worded for the reader, as SearchEngine takes it.

resolveLabel answers the word a wire value reads as: a category, a way's tags. units, when stated here, replaces the control's own units for the sentences this wording words, and an application states one or the other.

query

string

The query, when the application owns it. Unset, the control owns its own, whether or not onQueryChange is supplied.

viewportScope

boolean

Whether the search is restricted to the visible area, when the application owns it. Unset, the control owns its own, whether or not onViewportScopeChange is supplied.

strings

SearchControlStrings

Overrides the words this element renders, for this element only.

Folded onto whatever the provider resolved, so an override naming one key leaves the rest of the section alone. Scoped to the sections this element reads: a key it never renders is a type error rather than a silent no-op.

Handlers

An on* handler suppresses the element's own default. Left unset, the element acts; set, it becomes presentational and your handler decides. The two never both fire.

onQueryChange

(query: string) => void

Called with the query each keystroke and each clear asks for. With query supplied it is how the application is asked to change the value. With none it observes: the control has already written its own.

onViewportScopeChange

(scoped: boolean) => void

Called with the scope a press on the checkbox asks for. With viewportScope supplied it is how the application is asked to change the value. With none it observes.

onSelect

(row: SearchRow) => void

Overrides what picking a result does.

Unset, the control moves the camera onto the result and draws it with the map's setSearchHighlight, as pickTarget of @mountaya/elements/search answers. Set, it does neither and the handler decides: the assembled studio routes a pick through its own mutation surface this way while rendering this exact list.

onSearch

SearchFetch

Overrides how a round reaches the API. Unset, it routes the map's own search.

onError

(error: Error) => void

Called once for each branch whose request failed, with the failure.

Always an Error, as every element's onError is: an onSearch that rejects with any other value is reported as a MountayaElementsRejectionError holding that value as its cause. It reports and replaces nothing: the list still shows the branch's error line and its retry.