import "@arcgis/map-components/components/arcgis-search";
Search component provides a way to perform search operations
Demo
Properties
Property | Attribute | Type |
---|---|---|
active-menu | "none" | "source" | "suggestion" | "warning" | |
activeSource readonly |
| |
active-source-index | number | |
all-placeholder | string | |
allSources readonly |
| |
auto-destroy-disabled | boolean | |
auto-select-disabled | boolean | |
defaultSources readonly |
| |
disabled | boolean | |
icon | string | |
include-default-sources-disabled | Function | boolean | |
label | string | |
location-disabled | boolean | |
max-results | number | |
max-suggestions | number | |
min-suggest-characters | number | |
popup-disabled | boolean | |
| ||
| ||
position | "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing" | |
reference-element | ArcgisLinkChart | ArcgisMap | ArcgisScene | string | |
resultGraphic readonly |
| |
result-graphic-disabled | boolean | |
results readonly |
| Array<any> |
search-all-disabled | boolean | |
search-term | string | |
selectedResult readonly |
| |
| ||
state readonly | state | "disabled" | "loading" | "ready" | "searching" |
suggestions readonly |
| Array<SearchResultsSuggestions> |
suggestions-disabled | boolean |
activeMenu
activeMenu: "none" | "source" | "suggestion" | "warning"
The current active menu of the Search widget.
- Attribute
- active-menu
- Default value
- "none"
activeSource
activeSource: LayerSearchSource | LocatorSearchSource
The source object currently selected.
- Default value
- null
activeSourceIndex
activeSourceIndex: number
The selected source's index.
- Attribute
- active-source-index
- Default value
- 0
allPlaceholder
allPlaceholder: string
String value used as a hint for input text when searching on multiple sources.
- Attribute
- all-placeholder
- Default value
- "Find address or place"
allSources
allSources: Collection<LayerSearchSource | LocatorSearchSource>
The combined collection of defaultSources and sources.
autoDestroyDisabled
autoDestroyDisabled: boolean
If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the `destroy` method when you are done to prevent memory leaks.
- Attribute
- auto-destroy-disabled
- Default value
- false
autoSelectDisabled
autoSelectDisabled: boolean
Indicates whether to automatically select and zoom to the first geocoded result.
- Attribute
- auto-select-disabled
- Default value
- false
defaultSources
defaultSources: Collection<LayerSearchSource | LocatorSearchSource>
A read-only property that is a Collection of LayerSearchSource and/or LocatorSearchSource.
disabled
disabled: boolean
When true, the widget is visually withdrawn and cannot be interacted with.
- Attribute
- disabled
- Default value
- false
icon
icon: string
Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component). Search Calcite Icons for possible values.
- Attribute
- icon
- Default value
- "search"
includeDefaultSourcesDisabled
includeDefaultSourcesDisabled: Function | boolean
Indicates whether or not to include defaultSources in the Search UI.
- Attribute
- include-default-sources-disabled
- Default value
- false
locationDisabled
locationDisabled: boolean
Enables location services within the widget.
- Attribute
- location-disabled
- Default value
- false
maxResults
maxResults: number
The maximum number of results returned by the widget if not specified by the source.
- Attribute
- max-results
- Default value
- 6
maxSuggestions
maxSuggestions: number
The maximum number of suggestions returned by the widget if not specified by the source.
- Attribute
- max-suggestions
- Default value
- 6
minSuggestCharacters
minSuggestCharacters: number
The minimum number of characters needed for the search if not specified by the source.
- Attribute
- min-suggest-characters
- Default value
- 3
popupDisabled
popupDisabled: boolean
Indicates whether to display the Popup on feature click.
- Attribute
- popup-disabled
- Default value
- false
popupTemplate
popupTemplate: PopupTemplate
A customized PopupTemplate for the selected feature.
portal
portal: Portal
It is possible to search a specified portal instance's locator services Use this property to set this ArcGIS Portal instance to search.
position
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
- Attribute
- position
- Default value
- "top-right"
referenceElement
referenceElement: ArcgisLinkChart | ArcgisMap | ArcgisScene | string
- Attribute
- reference-element
resultGraphic
resultGraphic: Graphic
The graphic used to highlight the resulting feature or location.
resultGraphicDisabled
resultGraphicDisabled: boolean
Indicates if the resultGraphic will display at the location of the selected feature.
- Attribute
- result-graphic-disabled
- Default value
- false
results
results: Array<any>
An array of objects, each containing a SearchResult from the search.
searchAllDisabled
searchAllDisabled: boolean
Indicates whether to display the option to search all sources.
- Attribute
- search-all-disabled
- Default value
- false
searchTerm
searchTerm: string
The value of the search box input text string.
- Attribute
- search-term
sources
sources: Collection<SearchSource>
The Search widget may be used to search features in a map/feature service feature layer(s), SceneLayers with an associated feature layer, BuildingComponentSublayer with an associated feature layer, GeoJSONLayer, CSVLayer or OGCFeatureLayer, or table, or geocode locations with a locator.
state
state: "disabled" | "loading" | "ready" | "searching"
The current state of the widget.
- Attribute
- state
- Default value
- "ready"
suggestions
suggestions: Array<SearchResultsSuggestions>
An array of results from the suggest method.
suggestionsDisabled
suggestionsDisabled: boolean
Enable suggestions for the widget.
- Attribute
- suggestions-disabled
- Default value
- false
Methods
Method | Signature |
---|---|
blurSearch(): Promise<void> | |
clearSearch(): Promise<void> | |
componentOnReady(): Promise<void> | |
destroy(): Promise<void> | |
focusSearch(): Promise<void> | |
search(term: __esri.Point | __esri.SuggestResult | nullish | number[] | string): Promise<__esri.SearchResponse | nullish> | |
suggest(term: string): Promise<__esri.SuggestResponse | nullish> |
componentOnReady
componentOnReady(): Promise<void>
Create a promise that resolves once component is fully loaded.
- Returns
- Promise<void>
search
search(term: __esri.Point | __esri.SuggestResult | nullish | number[] | string): Promise<__esri.SearchResponse | nullish>
Parameters
Parameter | Type | Optional? |
---|---|---|
term | Array<number> | Point | SuggestResult | null | string | undefined |
- Returns
- Promise<SearchResponse | null | undefined>
suggest
suggest(term: string): Promise<__esri.SuggestResponse | nullish>
Parameters
Parameter | Type | Optional? |
---|---|---|
term | string |
- Returns
- Promise<SuggestResponse | null | undefined>
Events
Event | Type |
---|---|
SearchSearchBlurEvent | |
SearchSearchClearEvent | |
SearchSearchCompleteEvent | |
SearchSearchFocusEvent | |
{ name: "state"; } | |
undefined | |
SearchSelectResultEvent | |
SearchSearchStartEvent | |
SearchSuggestCompleteEvent | |
SearchSuggestStartEvent |
arcgisBlur
arcgisBlur: SearchSearchBlurEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisClear
arcgisClear: SearchSearchClearEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisComplete
arcgisComplete: SearchSearchCompleteEvent
Emitted when the component is complete.
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisFocus
arcgisFocus: SearchSearchFocusEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisPropertyChange
arcgisPropertyChange: { name: "state"; }
Emitted when the value of a property is changed. Use this to listen to changes to properties.
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisReady
arcgisReady: undefined
Emitted when the component associated with a map view is is ready to be interacted with.
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisSelectResult
arcgisSelectResult: SearchSelectResultEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisStart
arcgisStart: SearchSearchStartEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisSuggestComplete
arcgisSuggestComplete: SearchSuggestCompleteEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisSuggestStart
arcgisSuggestStart: SearchSuggestStartEvent
Events triggered on this element will be propagated to their outermost elements.
The event is composable and will propagate across the shadow DOM into the standard DOM.
The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.