Skip to content

Commit fcb8647

Browse files
committed
docs: explain additional template properties (active, index, searchTerm)
1 parent 46dfc02 commit fcb8647

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Similar to the string template mentioned above, you can use the row template to
175175
</ge-autocomplete>
176176
```
177177

178-
**Pro Tip™:** Use the `item.active` property to check if the current row is being hovered over or activated via arrow keys.
178+
**Pro Tip™:** Use the `item.active` property to check if the current row is being hovered over or activated via arrow keys. See below for additional properties.
179179

180180
The example above could render a little flag icon for the result’s country, for example. You can customize the styling by defining custom classes in the same way you would customize the CSS variables. It’s best to prefix your classes to avoid conflicts with internal classnames of the element.
181181

@@ -184,6 +184,18 @@ The [lodash template language][_template] supports much more than just straight
184184
[_template]: https://lodash.com/docs/4.17.15#template
185185

186186

187+
### Additional Template Properties
188+
189+
Inside a template you can access the following properties:
190+
191+
|Property|Type|Contains|
192+
|--------|----|--------|
193+
|`item.feature`|Object|The selected item, a [GeoJSON Feature][geojsonfeature]|
194+
|`item.active`|Boolean|Whether or not the current item is active (hovered or selected with arrow keys)|
195+
|`item.searchTerm`|String|The current value of the search input field|
196+
|`item.index`|Number|The index of the item in the result list|
197+
198+
[geojsonfeature]: https://github.com/geocodeearth/core-js/blob/main/src/geojson.ts
187199

188200
## Example
189201

0 commit comments

Comments
 (0)