Skip to content
Shiny .NET v4.1 BETA - Linux, MacOS, & Blazor Support! TONS of new features and improvements across the board. Check It Out

AddressEntry

An address search control built on AutoCompleteEntry that queries a geocoding provider (Nominatim/OpenStreetMap by default) and returns structured address data with coordinates. Supports custom geocoding providers via IAddressSearchProvider.

  • NuGet downloads for Shiny.Maui.Controls
  • NuGet downloads for Shiny.Blazor.Controls
Frameworks
.NET MAUI
Blazor
AddressEntry
<shiny:AddressEntry SelectedAddress="{Binding Address}"
Placeholder="Search address..."
CountryCodes="us,ca" />

The control debounces input (400ms, 3-character threshold), queries the geocoding provider, and displays matching addresses in a dropdown.

PropertyTypeDefaultDescription
SelectedAddressAddress?nullSelected address (TwoWay)
SearchProviderIAddressSearchProvider?nullCustom geocoding provider (defaults to Nominatim)
CountryCodesstring?nullComma-separated ISO country codes to filter results
Placeholderstring"Search address..."Placeholder text
MaxDropDownHeightdouble250Maximum dropdown height
TextColorColor? / string?nullText color
PlaceholderColorColor? / string?nullPlaceholder color
DropDownBackgroundColorColor? / string?nullDropdown background
DropDownBorderColorColor? / string?nullDropdown border color
SpinnerColorColor? / string?nullLoading spinner color
FontSizedouble14Font size
FontFamilystring?nullFont family (MAUI only)
CornerRadiusdouble4Dropdown corner radius (MAUI only)
EventArgsDescription
AddressSelectedAddressFires when an address is selected

The Address record provides structured address data:

PropertyTypeDescription
DisplayNamestringFull formatted address
HouseNumberstring?House/building number
Streetstring?Street name
Citystring?City, town, or village
Statestring?State or province
PostalCodestring?Postal/ZIP code
Countrystring?Country name
CountryCodestring?ISO country code
LatitudedoubleLatitude coordinate
LongitudedoubleLongitude coordinate

Implement IAddressSearchProvider to use your own geocoding service:

public interface IAddressSearchProvider
{
Task<IList<Address>> SearchAsync(string query, string? countryCodes, CancellationToken ct);
}

Example with a custom provider:

public class GoogleGeoProvider : IAddressSearchProvider
{
readonly HttpClient http;
public GoogleGeoProvider(HttpClient http) => this.http = http;
public async Task<IList<Address>> SearchAsync(string query, string? countryCodes, CancellationToken ct)
{
// Call Google Geocoding API
var response = await http.GetFromJsonAsync<GoogleResult>($"...", ct);
return response.Results.Select(r => new Address(
r.FormattedAddress,
r.AddressComponents.HouseNumber,
r.AddressComponents.Street,
r.AddressComponents.City,
r.AddressComponents.State,
r.AddressComponents.PostalCode,
r.AddressComponents.Country,
r.AddressComponents.CountryCode,
r.Geometry.Location.Lat,
r.Geometry.Location.Lng
)).ToList();
}
}
<shiny:AddressEntry SearchProvider="{Binding MyGeoProvider}"
SelectedAddress="{Binding Address}" />
<shiny:AddressEntry SelectedAddress="{Binding Address}"
FontSize="16"
TextColor="Black"
DropDownBackgroundColor="#F9FAFB"
DropDownBorderColor="#6B7280"
CornerRadius="8" />
<AddressEntry SelectedAddress="@selectedAddress"
SelectedAddressChanged="OnAddressChanged"
Placeholder="Search address..."
CountryCodes="us,ca"
FontSize="16"
TextColor="#333"
InputClass="my-input"
DropDownClass="my-dropdown" />
@code {
Address? selectedAddress;
void OnAddressChanged(Address? address)
{
selectedAddress = address;
if (address is not null)
{
Console.WriteLine($"Lat: {address.Latitude}, Lng: {address.Longitude}");
}
}
}
PropertyTypeDefaultDescription
InputClassstring?nullCSS class for the input element
DropDownClassstring?nullCSS class for the dropdown

The built-in NominatimAddressSearchProvider queries OpenStreetMap’s free Nominatim API:

  • Includes a User-Agent: Shiny.Maui.Controls/1.0 header (required by Nominatim usage policy)
  • Returns up to 5 results per query
  • Supports country code filtering via the CountryCodes parameter
  • For production use with high traffic, consider implementing a custom provider with a commercial geocoding service
claude plugin marketplace add shinyorg/skills
claude plugin install shiny-controls@shiny
copilot plugin marketplace add https://github.com/shinyorg/skills
copilot plugin install shiny-controls@shiny
View shiny-controls Plugin