Skip to content

Commit 522defb

Browse files
feat: change icon in search control reset button (#419)
1 parent 10586b2 commit 522defb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/usage.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { GeoSearchControl, OpenStreetMapProvider } from 'leaflet-geosearch';
4242
const searchControl = new GeoSearchControl({
4343
provider: new OpenStreetMapProvider(),
4444
style: 'bar',
45+
resetButton: '🔍', // Example of using a magnifying glass icon
4546
});
4647

4748
map.addControl(searchControl);

src/SearchControl.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const defaultOptions: Omit<SearchControlProps, 'provider'> = {
5656
autoClose: false,
5757
keepResult: false,
5858
updateMap: true,
59+
resetButton: '×',
5960
};
6061

6162
const UNINITIALIZED_ERR =
@@ -110,6 +111,7 @@ interface SearchControlProps {
110111
autoClose: boolean;
111112
keepResult: boolean;
112113
updateMap: boolean;
114+
resetButton: string;
113115
}
114116

115117
export type SearchControlOptions = Partial<SearchControlProps> & {
@@ -202,7 +204,7 @@ const Control: SearchControl = {
202204
this.classNames.resetButton,
203205
this.searchElement.form,
204206
{
205-
text: '×',
207+
text: this.options.resetButton,
206208
'aria-label': this.options.clearSearchLabel,
207209
onClick: () => {
208210
if (this.searchElement.input.value === '') {

0 commit comments

Comments
 (0)