Skip to
Keyboard shortcuts

Use the up and down arrow keys to move between items. Press Alt+Shift+K to open this list again.

Alpha version out now. The API may still change.

AddressSearch

A search field that finds an address as you type or on Search, on its own or with a map. You get the address the visitor picks, with its position, and decide what happens next. You choose the geocoder (the service that finds addresses), and nothing is sent to it until the visitor types.

Package
@kvirn-ui/map
Pattern
APG Combobox (editable, list autocomplete)
Testing
Automated. Core 0 of 2, Release 0 of 3

When to use it#

  • Use it when a visitor knows an address and the answer should appear in your service: on a map, such as the recycling stations around their home, or in a form, where it fills in the address boxes. The visitor types a street, a postal code or a place, and picks an address from a list.
  • In a form, AddressInput with a geocoder also suggests addresses in its street box. Use AddressSearch for a search of its own, above the boxes or beside a map. Not for an address the visitor knows by heart: use AddressInput alone, since a lookup adds a step and a third party.
  • Not for anything other than addresses, such as case numbers or people: use a Combobox over your own data. Not for searching the pages of a site.
  • A geocoder that says it allows search as you type (suggest: true) is searched about 0.4 seconds after the last key, and the field has no Search button. Any other geocoder is searched when the visitor presses Enter or Search, and typing sends nothing. debounce={false} turns search as you type off for any geocoder.
  • What the visitor types, and their IP address, go to the geocoder you choose. Choose one whose terms allow your use. A public Nominatim server does not allow search as you type, and Google’s terms limit how you may show and keep its results. KvirnUI recommends neither for forms that residents fill in. It names no service and has no default.

Example#

No address is chosen.

The examples on this page send what you type to geo.kvirn.com, Kvirn’s own address service, hosted in the EU and setting no cookies. Your text and your IP address reach it, and only once you type (in the fault example, once you press Enter or Search). Don’t type your own address. Try a Swedish street and town, such as Drottninggatan 6, Stockholm. The map example also loads its map from geo.kvirn.com as soon as it is shown.

Information: Did you know?

Name your address service in your privacy notice: the text typed and the visitor’s IP address reach it (GDPR). The field already says where the text goes. A screen reader reads that notice when the field gets focus.

Use cases#

Find recycling stations near your home

A resident types their address. The map moves to it and draws a pin, and the list under the map shows the recycling stations now in view. The zoom out button shows more. Picking an address does not move focus, so the resident stays in the field. The search sits inside Map.Root, before the map, and calls show and clearResult from useMapState. Once the map has moved, a screen reader says “The map shows the address.” and how many places are in view. See What a screen reader reads.

Props in this example:

Warning: Don't forget

Keep the Map list on the page. The pin is decoration. The list and the details are how everyone reaches a place (2.1.1 Keyboard, 1.1.1 Non-text Content).

Report a fault near an address

A resident reports a broken street light. They search for the street, and the town if they know it, and the report keeps the address and its position. This geocoder allows search as you type, but debounce={false} makes the field search on request: typing sends nothing, the field has a Search button, and the text is sent only when the resident presses Enter or Search. The resident then picks an address from the list.

No address is chosen.

Props in this example:

Information: Implement like this

To search your own register instead of a public service, write the geocoder yourself. Pass signal to fetch, so a new search cancels the old one. Give each address a full label with the town.

const geocoder: GeocoderProvider = {
  name: 'our address register',
  search: async (query, { signal }) => {
    const response = await fetch(`/api/addresses?q=${encodeURIComponent(query)}`, { signal })
    if (!response.ok) throw new Error('Address search failed')
    return response.json() // AddressResult[]: { id, label, position: { longitude, latitude } }
  },
}

Report a change of address with a search above the boxes

A resident reports a new address. They search first, and a pick fills the street, the postal code and the town. The example leaves line 2 alone. The boxes stay editable, so the resident can correct them or skip the search. Enter in the search looks up and does not send the form: the Report the change button does. A pick that has no postal address, such as a park, is turned down with describePick: the list stays open and a message says that nothing is filled in. Only a real address says that the boxes are filled in. The box validation is left out here; see Fix the boxes that are wrong on the AddressInput page. After a pick, a screen reader says “Chosen:”, the address, and “The address is filled in below. Check it before you continue.” See What a screen reader reads.

Your new address

Props in this example:

Warning: Don't forget

Keep the address boxes editable and the search optional. A lookup can fail or find nothing, and nobody should have to type an address twice (3.3.7 Redundant Entry).

Accessibility#

What it does for you#

  • Scope: AddressSearch, an Autocomplete over the answers of a geocoder (a service that turns typed text into addresses). A visitor types a street, a postal code or a place, searches, and picks an address. onResult gets the address with its position. The roles, states and keys of the field, the popup and the suggestions come from the Autocomplete and are tested there. This page lists what AddressSearch adds.
  • APG pattern: Combobox: Editable Combobox With List Autocomplete, through Autocomplete (aria-autocomplete="list", manual selection).
  • Deviations: one, approved by the maintainer (2026-10-19). Enter with no suggestion active, while no text is being composed with an input method (the way some languages are typed), searches and calls preventDefault, so it never submits a form: the text is a lookup, not an answer. The form's own submit button sends it. Enter on an active suggestion picks it, as in the APG.
  • Native elements used: <input type="text" role="combobox">, <label for>, <div popover="manual">, <div role="listbox">, <div role="option">, <button type="button"> (Clear, Search).

You choose the geocoder. The library names no web address and sends nothing until the visitor types and, on request, presses Search.

PartElement / roleARIA / stateNotes
AddressSearch.Roota Field.Root (<div class="kv-address-search">)data-status: idle, too-short, searching, results, empty, error, offline, selected, rejectedOwns geocoder, onResult, minLength, debounce, timeoutMilliseconds, country, limitToCountry, describePick, initialText, disabled, id, messages; none reaches the DOM. Put it in <search> beside a map, not in a form
AddressSearch.Label<label for>noneThe visible name. Default addressSearch.label. No required or optional marker
AddressSearch.Input<input type="text" role="combobox">the Autocomplete's; aria-describedby the help text, then the noticeautocomplete="off"
AddressSearch.Clear<button type="button" tabindex="-1">named by combobox.clear and the labelEmpties the text, calls onResult(null), focus stays on the input
AddressSearch.Submit<button type="button">none; named by its text, addressSearch.submitRendered only on request. Never submits a form
AddressSearch.HelpText<p> (Field help text)noneaddressSearch.helpRequest or helpSuggest
AddressSearch.Notice<p> (Field help text)noneSays where the text goes (addressSearch.privacy), then the geocoder's attribution
AddressSearch.Popup<div popover="manual">the Autocomplete'sThe status line, then the suggestions
AddressSearch.Status<div>, plain text with an icondata-state: too-short, searching, empty, error, offline, rejected; never a live regionSearching, too short, no result, error, offline, a pick describePick rejected. Said again through the Announcer
AddressSearch.List / Optionrole="listbox" / role="option"the Autocomplete's; aria-selected="false" alwaysThe option text is the geocoder's label

Rules, tested in address-search.test.tsx:

  • The ARIA 1.2 combobox, named by the visible label, described by the help text and then the notice (address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice).
  • Nothing is sent on mount, on focus or with empty text (address-search.test.tsx › nothing is sent on mount, focus or with empty text).
  • As you type is used only when the geocoder declares suggest: true: below minLength nothing is sent or announced (address-search.test.tsx › below minLength no request is sent and nothing is announced), one request follows a pause, not each key (address-search.test.tsx › one request after the debounce of no typing, not one per keystroke), a new key abandons the request in flight and a late answer for old text is never shown (address-search.test.tsx › a new keystroke aborts the request in flight and a late answer for old text is never shown), and the request carries the intent and the provider's locale (address-search.test.tsx › passes the intent suggest as you type and submit for Enter, with the provider locale).
  • On request (a geocoder without suggest, or debounce={false}): typing sends nothing, and Enter or Search sends one request (address-search.test.tsx › typing sends nothing, and Enter or Search sends one request (a geocoder without suggest), address-search.test.tsx › typing sends nothing with debounce={false} although the geocoder suggests). Below minLength it says what is missing and sends nothing (address-search.test.tsx › Enter or Search below minLength shows and announces tooShort and sends nothing).
  • Every state has words, and the same words are announced once (4.1.3): searching keeps the earlier options (address-search.test.tsx › searching shows the status, announces searching and keeps the earlier options in place), n results (address-search.test.tsx › n results are listed, the count is announced once after the answer and nothing is active), none, which is not invalid (address-search.test.tsx › no results shows and announces noResults with the query, reports collapsed and is not invalid), a rejection (address-search.test.tsx › a rejection shows and announces error, and the text stays), no answer in time (address-search.test.tsx › no answer within the timeout shows and announces error) and offline, with no request sent (address-search.test.tsx › offline shows and announces offline and sends no request). The Autocomplete's own count and "No results" are switched off (announceResults={false}), so nothing is said twice.
  • A pick puts the label in the field, calls onResult once, keeps focus on the input and announces addressSearch.picked (3.2.2, 4.1.3): with Enter, Alt+ArrowUp or a press. A suggestion without a position is resolved first (address-search.test.tsx › a suggestion without a position is resolved on pick: searching shows, resolve runs once and onResult gets the position; address-search.test.tsx › a resolve that fails shows error and calls no onResult).
  • With a map, show(result) fits the bounds or centres, draws a decorative result pin, keeps focus and announces map.addressShown once the view settles (address-search.test.tsx › show(result) fits the bounds or centres, draws the pin, keeps focus and announces addressShown once settled). clearResult() removes the pin and announces nothing (address-search.test.tsx › clearResult removes the pin and announces nothing).
  • In a form, result.address fills the AddressInput boxes, which stay editable (3.3.7; address-search.test.tsx › the result address fills the boxes, which stay editable).
  • data-status and data-state carry the state (address-search.test.tsx › Root data-status follows the state, and Status data-state names the state its words describe). The Status line is absent for idle, results and selected.
  • Root options reach the search and not the DOM: country is sent to the geocoder, limitToCountry drops answers in another country, describePick decides what a pick says and initialText starts the input (address-search.test.tsx › country is sent to the geocoder and is not a DOM attribute, › limitToCountry drops the answers in another country and is not a DOM attribute, AddressSearch read aloud › a pick with describePick says its announcement in place of chosen, › initialText is the text the input starts with and is not a DOM attribute).
  • Every string comes from addressSearch.* and is overridable per instance (address-search.test.tsx › every string comes from addressSearch.* and is overridable per instance, address-search.test.tsx › a per-instance message replaces the catalog text).

What you need to do#

  • Name where the text goes. The notice names the geocoder (name) and carries its attribution. Name the service in your privacy notice too (GDPR): the typed text and the visitor's IP address reach it.
  • Choose a geocoder that allows your use. Set suggest: true only if its terms allow a request per pause in typing. A public Nominatim server does not.
  • Keep the boxes. In a form, keep the address boxes editable and the search optional: a lookup can fail, and the visitor must be able to type the address (3.3.7).
  • Put the search where the result lands. Before the map, or above the address boxes, in that reading order. Wrap it in <search> beside a map, and not inside a form.
  • Keep the list on the map. The result pin is decoration; the map's list and details remain the way to reach places.

Warning: Don't forget

Put the search where its result lands: before the map, or above the address boxes. The reading order and the Tab order then follow the task (2.4.3 Focus Order).

Visual and modes#

Field, Clear, the focus indicator and the popup are the Autocomplete's (kv-autocomplete-*; see autocomplete.a11y.md). AddressSearch adds the Search button, the status line, the notice and, beside a map, the result pin.

  • Focus. The Search button shows a ring in the focus colour, drawn inside its edge, and the input keeps the Autocomplete's ring. The focus colour is checked against the field's surface by theme:check (2.4.7, 1.4.11).
  • Target size. Clear is as high as the control, 44px (32px compact), and Search at least 40px (28px compact) high, both at least 44px wide (32px compact), so above 24 × 24 CSS px (2.5.8). Axe's target-size rule checks them in the stories.
  • Reflow. The label, help text and notice wrap. The control wraps: the input keeps at least 10 characters, then Search drops below it, so nothing is clipped at 320px or at 400% zoom (1.4.10). The words do not depend on spacing (1.4.12).
  • Not colour alone. Each state has words in the status line, with a spinner (searching), the error icon (error) or the info icon (offline) beside them. The other states are words only (1.4.1).
  • Result pin. kv-map-search-result is decorative and aria-hidden, not interactive, and has a canvas-coloured edge and dot so it reads on any tile (1.4.11).
  • Forced colours. Search uses ButtonFace and ButtonText with a ButtonBorder divider, disabled is GrayText, and the pin is CanvasText with a Canvas edge. The status icons use the text colour.
  • Reduced motion. The spinner is the library's, and it turns only under prefers-reduced-motion: no-preference. Under reduced motion the map jumps to the address.
  • Right-to-left. Clear, then Search, sit at the inline end. The pin is placed from the map's own coordinates and does not flip.

Focus management#

  • Initial focus: not moved. A result, an error and the map moving never take focus.
  • Trap: no. The popup is not modal, and Tab always leaves the input (2.1.2).
  • Restore to: the input, which never lost focus. A pick, Clear and Escape keep it there.
  • Never obscured by: the popup is placed under the Control and flips above it when there is no room (2.4.11).

WCAG success criteria#

  • 1.1.1 Non-text Content (A): the pin is decorative and the map's list stays the equivalent (address-search.test.tsx › show(result) fits the bounds or centres, draws the pin, keeps focus and announces addressShown once settled).
  • 1.3.1 Info and Relationships (A), 4.1.2 Name, Role, Value (A): the combobox, its label and its description (address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice).
  • 1.4.1 Use of Color (A): every state has words (the states and announcements tests, and address-search.test.tsx › Root data-status follows the state, and Status data-state names the state its words describe).
  • 1.4.3 Contrast (Minimum) (AA), 1.4.11 Non-text Contrast (AA): the text, border and focus pairs are the theme's, checked by theme:check. No new pair.
  • 1.4.10 Reflow (AA), 1.4.12 Text Spacing (AA): the reflow and text-spacing sweep projects run the stories (the map folder is in sweepComponents). No unit test.
  • 2.1.1 Keyboard (A), 2.4.3 Focus Order (A): every row of the Keyboard table names a test.
  • 2.1.2 No Keyboard Trap (A): Tab leaves the input, with the popup open or closed (autocomplete.test.tsx › Tab closes the popup without picking the active suggestion, and moves focus on).
  • 2.4.6 Headings and Labels (AA), 2.5.3 Label in Name (A): the visible label is the name, and Search is named by its text (address-search.test.tsx › Search is a native type=button, one Tab stop after the input, searches on Enter and on Space, and never submits a form).
  • 2.4.7 Focus Visible (AA), 2.4.11 Focus Not Obscured (Minimum) (AA): the ring and the popup placement are the Autocomplete's, tested there. The Search button's ring is in the theme and is not asserted by a test.
  • 2.5.8 Target Size (Minimum) (AA): Clear and Search are at least 40px (28px compact). Axe's target-size rule runs in every story of the reflow sweep, which caught and proved it.
  • 3.2.1 On Focus (A), 3.2.2 On Input (A): focus and typing change nothing, and a pick, a search and a map move keep focus and never submit a form (address-search.test.tsx › nothing is sent on mount, focus or with empty text, address-search.test.tsx › Enter with no suggestion active, inside a form, searches now and the form does not submit).
  • 3.3.2 Labels or Instructions (A): the help text says what to type (address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice).
  • 3.3.7 Redundant Entry (A): the address fills the boxes, which stay editable (address-search.test.tsx › the result address fills the boxes, which stay editable).
  • 4.1.3 Status Messages (AA): every state is announced once (the tests under Every state has words, and the Read aloud table).

1.3.5 Identify Input Purpose does not apply: the lookup is not a known purpose, so the input has autocomplete="off". The AddressInput boxes carry the tokens.

Keyboard#

Focus
aria-activedescendant. DOM focus stays on the input, and the active suggestion is aria-activedescendant
Selection follows focus
no (Enter, Alt+ArrowUp or a press picks a suggestion, and the arrow keys only move the highlight)
Arrows wrap
no
Shortcuts
none
KeyWhereWhat happens
Tabbefore the searchMoves focus to the input, one stop. Clear is not a stop
Test: autocomplete.test.tsx › Tab moves to the input, one stop
Tabon the input, on requestMoves focus to the Search button, then on. In as-you-type mode there is no button
Test: address-search.test.tsx › Search is a native type=button, one Tab stop after the input, searches on Enter and on Space, and never submits a form
Shift+Tabon the Search buttonMoves focus back to the input
Test: address-search.test.tsx › Search is a native type=button, one Tab stop after the input, searches on Enter and on Space, and never submits a form
Shift+Tabon the inputMoves focus to the previous focusable element
Test: autocomplete.test.tsx › Shift+Tab leaves the input backwards
Enteron the input, no suggestion activeSearches now, flushing the debounce, and never submits a form
Test: address-search.test.tsx › Enter with no suggestion active, standalone, searches now and flushes the debounce
Enteron the input in a form, no suggestion activeSearches now. The form is not submitted: its own submit button sends it
Test: address-search.test.tsx › Enter with no suggestion active, inside a form, searches now and the form does not submit
Enteron the input, text unchanged since the answerOpens the last list without activating a suggestion, and says the count again
Test: address-search.test.tsx › Enter on text unchanged since the last answer reopens the list without activating it and says the count again
Enter / Spaceon the Search buttonSearches with the text in the field
Test: address-search.test.tsx › typing sends nothing, and Enter or Search sends one request (a geocoder without suggest)
Enterpopup open, a suggestion is activePicks it: the label fills the input, the popup closes, focus stays
Test: address-search.test.tsx › pick with Enter: the text becomes the label, onResult is called once, focus stays and picked is announced
Alt+ArrowUppopup open, a suggestion is activePicks it, as Enter does
Test: address-search.test.tsx › pick with Alt+ArrowUp: the text becomes the label, onResult is called once, focus stays and picked is announced
ArrowDown / ArrowUppopup openActivates the next or the previous suggestion. Stops at the ends
Test: autocomplete.test.tsx › arrows move the active suggestion and stop at the ends, and typing clears it
PageDown / PageUppopup openMoves the active suggestion ten on or back
Test: autocomplete.test.tsx › PageDown and PageUp move ten suggestions and stop at the ends
Home / Endon the inputMove the caret, as in any input. No suggestion stays active
Test: autocomplete.test.tsx › Home, End, ArrowLeft, ArrowRight and Space are left to the input: the caret moves, and no suggestion stays active
Escapepopup openCloses the popup. The text stays, and so does focus
Test: autocomplete.test.tsx › the text is never cleared silently: Escape and Tab keep it
Tabpopup openCloses the popup without picking, keeps the text, and moves focus on
Test: autocomplete.test.tsx › Tab closes the popup without picking the active suggestion, and moves focus on
Shift+Tabpopup openCloses the popup without picking, and moves focus back
Test: autocomplete.test.tsx › Shift+Tab closes the popup without picking and moves focus back
Pointer presson a suggestionPicks it, and keeps focus on the input
Test: address-search.test.tsx › pick by press: the text becomes the label, onResult is called once, focus stays and picked is announced
Pointer presson ClearEmpties the text, calls onResult(null) and keeps focus on the input
Test: address-search.test.tsx › Clear empties the text, calls onResult(null) and leaves focus on the input

The input is one Tab stop and Clear is not (tabindex="-1"). Nothing here moves focus on its own: a pick, a search and a map that moves leave focus in the field (3.2.2). A key that is not in this table is left to the browser.

Information: Did you know?

Enter with no suggestion chosen searches and never sends the form around the field. The form’s own submit button sends it. Keep that button visible, so the form can always be sent with the keyboard.

Announcements#

AddressSearch tells screen reader users about these changes without moving focus. Each message waits until the screen reader is quiet (polite) or interrupts it (assertive).

WhenWhat it saysMessage keyPoliteness
Enter or Search with fewer than minLength charactersaddressSearch.tooShortPolite
A request is on its way (dropped if the answer comes first)addressSearch.searchingPolite
The answer has addressesaddressSearch.resultCountPolite
The answer has noneaddressSearch.noResultsPolite
The search fails or gets no answer in timeaddressSearch.errorPolite
The browser is offline when a search is sentaddressSearch.offlinePolite
A pickaddressSearch.picked pickedFilledPolite
A pick with a map: when the view settlesmap.addressShownPolite
A pick that describePick rejectsdescribePick rejectedPolite
A pick, with describePick returning an announcementaddressSearch.pickedPolite

The text in all five languages

Change the text#

For your whole app, pass messages to KvirnProvider. For one AddressSearch, pass its messages prop.

<KvirnProvider messages={{ addressSearch: { tooShort: '…' } }}>

Warning: Don't forget

Announcements need a KvirnProvider around your app, outside any <form>, or an Announcer of your own. Without one nothing is announced, and a development warning says so.

What a screen reader reads#

State or actionRead aloudPolitenessTest
Focus on the fieldcombobox, Find an address, Type a street and number, …, has popup listbox, not expanded, autocomplete in list, 1 control, then button, Searchnoneaddress-search.test.tsx › AddressSearch read aloud › focus: the field is read with its label, help text, privacy notice and state, then the Search button
Typingnothing (the active suggestion is read through aria-activedescendant)noneaddress-search.test.tsx › AddressSearch read aloud › typing says nothing, and no request is sent
Searchingpolite: Searching for addressespoliteaddress-search.test.tsx › AddressSearch read aloud › a slow search says it is searching
n resultspolite: 2 addresses found, then option, Storgatan 1, 211 22 Malmö, not selected, position 1, set size 2 and the nextpoliteaddress-search.test.tsx › AddressSearch read aloud › Search says the count, and the list is read as options
Too shortpolite: Type at least 3 characters to search.politeaddress-search.test.tsx › AddressSearch read aloud › Search below minLength says what is missing
No resultspolite: No address found for “nowhere”. Check the spelling, or add the town.politeaddress-search.test.tsx › AddressSearch read aloud › no address found says what to check
Errorpolite: The address search isn’t working right now. Try again in a moment.politeaddress-search.test.tsx › AddressSearch read aloud › an error says to try again
Offlinepolite: You’re offline. Connect to the internet, then search again.politeaddress-search.test.tsx › AddressSearch read aloud › offline says to connect and search again
Pickpolite: Chosen: <address label>.politeaddress-search.test.tsx › AddressSearch read aloud › a pick says which address was chosen
Pick with a mappolite: Chosen: <address label>., then polite: The map shows the address. 0 places.politeaddress-search.test.tsx › AddressSearch with a map › a pick with a map says which address was chosen, then that the map shows it
Pick rejectedpolite: <the rejected text>, and the same words in the status linepoliteaddress-search.test.tsx › AddressSearch read aloud › a pick that describePick rejects says the rejected text instead of choosing
Pick with describePickpolite: <the announcement> in place of Chosen: …politeaddress-search.test.tsx › AddressSearch read aloud › a pick with describePick says its announcement in place of chosen
Clearnothingnoneaddress-search.test.tsx › AddressSearch read aloud › Clear says nothing

API reference#

Install the package. Import the theme once. The map’s styles are needed only when the search sits beside a map, and then MapLibre is needed too: see the Map page.

pnpm add @kvirn-ui/map
import '@kvirn-ui/theme/theme.css'
// Only when the search sits beside a map:
import '@kvirn-ui/theme/map.css'

Information: Implement like this

To change a text or add a class, build the field from its parts. AddressSearch is these parts in this order. Keep it: the input is described by the help text, then the notice.

<AddressSearch.Root geocoder={geocoder} onResult={onResult}>
  <AddressSearch.Label>Find your address</AddressSearch.Label>
  <AddressSearch.Control>
    <AddressSearch.Input />
    <AddressSearch.Clear />
    <AddressSearch.Submit />
  </AddressSearch.Control>
  <AddressSearch.HelpText />
  <AddressSearch.Notice />
  <AddressSearch.Popup>
    <AddressSearch.Status />
    <AddressSearch.List>{(item) => <AddressSearch.Option item={item} />}</AddressSearch.List>
  </AddressSearch.Popup>
</AddressSearch.Root>
import { AddressSearch, useAddressSearch } from '@kvirn-ui/map'
import { kvirnGeocoder } from '@kvirn-ui/map/kvirn' // or /nominatim, /google-places

AddressSearch

Renders The whole field, with the parts below in their default order: Label, Control (with Input, Clear and Submit), HelpText, Notice and Popup (with Status and List). It takes the props of AddressSearch.Root and label, and no children. On its own or beside a map, wrap it in a <search> element. Inside a form, leave <search> out.

PropTypeDefaultDescription
labelReactNodeaddressSearch.labelThe visible label. Write it for the task, such as “Find your address”. It is the field’s name for a screen reader, so keep it visible.
geocoderGeocoderProviderRequiredThe service that finds addresses, as an object (see GeocoderProvider below). Make it once, outside your component. Its name is shown in the privacy notice. Geocoders come from @kvirn-ui/map: kvirnGeocoder (from @kvirn-ui/map/kvirn), nominatim (@kvirn-ui/map/nominatim) and googlePlaces (@kvirn-ui/map/google-places). You can also write your own. Nothing is sent before the visitor types and, on request, presses Search. What is typed, and the visitor’s IP address, reach this service, so name it in your privacy notice. KvirnUI recommends neither Nominatim nor Google for forms that residents fill in: read their terms first.
onResult(result: AddressResult | null) => void–Called once with the address the visitor picks, with its position. Called with null when the visitor clears the field with Clear after a pick. It never moves focus. With a map, call show(result) and clearResult() on it. In a form, write result.address into your address boxes.
minLengthnumber3The fewest characters, after trimming spaces, before a search is sent. Below it, as you type, nothing is sent or said. On request, Enter or Search says how many characters are needed. The Kvirn map service needs at least 2.
debouncenumber | false400Milliseconds of no typing before a search as you type. false, or a geocoder without suggest: true, searches on request: Enter or the Search button.
timeoutMillisecondsnumber10000How long to wait for an answer, in milliseconds. After that the search counts as failed and the error text shows.
countrystring–A country as an ISO 3166-1 code, such as SE. It is sent to the geocoder, which ranks that country first. Results in other countries are still listed.
limitToCountrybooleanfalseWith country: drops the results that have an address in another country, for a form that can’t record one.
describePick(result: AddressResult, messages) => { rejected: string } | { announcement: string }–Decides what a pick means before onResult runs. { rejected } keeps the list open, restores the text the visitor typed, shows that text on the status line and announces it, and onResult is not called. { announcement } is announced instead of the picked text.
initialTextstring–The text the input starts with, for a field that already holds a value.
disabledbooleanfalseDisables the field and the Search button.
idstring–The id of the input. Without one the field makes its own.
messagesPartial<KvirnMessages["addressSearch"]>–Changes the texts of this field only. See Strings below for every key and its English text.

AddressSearch.Root

Renders A Field.Root, which is a <div class="kv-address-search">, that owns the search. Put the parts below inside it. It takes the props of Field.Root except messages, controlId and disabled, which the options below set. Also exported as AddressSearchRoot.

PropTypeDefaultDescription
geocoderGeocoderProviderRequiredThe service that finds addresses, as an object (see GeocoderProvider below). Make it once, outside your component. Its name is shown in the privacy notice. Geocoders come from @kvirn-ui/map: kvirnGeocoder (from @kvirn-ui/map/kvirn), nominatim (@kvirn-ui/map/nominatim) and googlePlaces (@kvirn-ui/map/google-places). You can also write your own. Nothing is sent before the visitor types and, on request, presses Search. What is typed, and the visitor’s IP address, reach this service, so name it in your privacy notice. KvirnUI recommends neither Nominatim nor Google for forms that residents fill in: read their terms first.
onResult(result: AddressResult | null) => void–Called once with the address the visitor picks, with its position. Called with null when the visitor clears the field with Clear after a pick. It never moves focus. With a map, call show(result) and clearResult() on it. In a form, write result.address into your address boxes.
minLengthnumber3The fewest characters, after trimming spaces, before a search is sent. Below it, as you type, nothing is sent or said. On request, Enter or Search says how many characters are needed. The Kvirn map service needs at least 2.
debouncenumber | false400Milliseconds of no typing before a search as you type. false, or a geocoder without suggest: true, searches on request: Enter or the Search button.
timeoutMillisecondsnumber10000How long to wait for an answer, in milliseconds. After that the search counts as failed and the error text shows.
countrystring–A country as an ISO 3166-1 code, such as SE. It is sent to the geocoder, which ranks that country first. Results in other countries are still listed.
limitToCountrybooleanfalseWith country: drops the results that have an address in another country, for a form that can’t record one.
describePick(result: AddressResult, messages) => { rejected: string } | { announcement: string }–Decides what a pick means before onResult runs. { rejected } keeps the list open, restores the text the visitor typed, shows that text on the status line and announces it, and onResult is not called. { announcement } is announced instead of the picked text.
initialTextstring–The text the input starts with, for a field that already holds a value.
disabledbooleanfalseDisables the field and the Search button.
idstring–The id of the input. Without one the field makes its own.
messagesPartial<KvirnMessages["addressSearch"]>–Changes the texts of this field only. See Strings below for every key and its English text.
Class or attributeValuesMeaning
data-statusidle, too-short, searching, results, empty, error, offline, selected or rejectedWhat the search is doing, for your styles. A search that finds nothing is empty, not an error. rejected means describePick turned a pick down.

AddressSearch.Label

Renders A <label for>, the visible name of the field. It takes the props of Field.Label. By default it shows no required or optional marker.

PropTypeDefaultDescription
childrenReactNodeaddressSearch.labelThe label text. Without children it shows the addressSearch.label text.

AddressSearch.Control

Renders The box around the input, Clear and Submit. The popup is placed against it. It takes the props of Autocomplete.Control.

AddressSearch.Input

Renders An <input type="text"> with the role combobox, with browser autofill turned off. It takes the props of Autocomplete.Input. Enter with no suggestion chosen searches, and never sends a form.

AddressSearch.Clear

Renders A <button type="button" tabindex="-1">, so it is not a Tab stop. It empties the text, calls onResult(null) after a pick and keeps focus on the input. It takes the props of Autocomplete.Clear.

AddressSearch.Submit

Renders The Search button: a native <button type="button"> named by the addressSearch.submit text. It renders only when the search runs on request, and it never sends a form. It takes the attributes of a <button>. Its children replace the text “Search”.

AddressSearch.HelpText

Renders A <p>, the field’s help text. The input is described by it. It takes the props of Field.HelpText.

PropTypeDefaultDescription
childrenReactNodethe help textThe instruction under the field. Without children it says to press Search (on request) or to choose from the list (as you type).

AddressSearch.Notice

Renders A <p> that says where the typed text goes, then shows the geocoder’s credit text. The input is described by it, after the help text, so a screen reader reads it when the field gets focus. It takes the props of Field.HelpText.

PropTypeDefaultDescription
childrenReactNodethe privacy noticeWithout children it says where the typed text goes, with the geocoder’s name, then shows the geocoder’s attribution (its credit text). If you replace it, say both yourself.

AddressSearch.Popup

Renders The popup that holds the status line and the list. It takes the props of Autocomplete.Popup.

AddressSearch.Status

Renders A <div> above the suggestions, in plain text with an icon: searching, too short, nothing found, error, offline or a pick turned down. It is not a live region. The same words are said through the Announcer, so they are not read twice. It renders nothing while the list is closed or there is no message.

Class or attributeValuesMeaning
data-statetoo-short, searching, empty, error, offline or rejectedWhich message the line shows, for your styles.

AddressSearch.List

Renders The listbox of suggestions, named by the label. It takes the props of Autocomplete.List.

PropTypeDefaultDescription
children(item: AddressSuggestion) => ReactNode–Renders one AddressSearch.Option per address: (item) => <AddressSearch.Option item={item} />. The options show only while the list is open.

AddressSearch.Option

Renders One suggestion, a <div role="option">. Its text is the geocoder’s label. It takes the props of Autocomplete.Option.

PropTypeDefaultDescription
itemAddressSuggestionRequiredOne of the addresses the list hands you.
childrenReactNodethe address labelThe content of the option. Without children it shows the geocoder’s label, which is also what fills the field and what a screen reader reads.

GeocoderProvider

Renders nothing: it is the object you pass in geocoder. KvirnUI names no service and has no default. To search your own register, write the object yourself: see the recipe under “Report a fault near an address”.

PropTypeDefaultDescription
namestring–Who receives the typed text. It is named in the privacy notice, so write it as a person says it: “Kvirn’s map service”. Without a name the notice says “an address service”.
attributionstring–The credit text that the service’s terms ask for. It is shown after the privacy notice.
suggestbooleanfalsetrue only if the service’s terms allow a search at each pause in typing. Then the field searches as you type. Otherwise it searches on request.
search(query: string, options: { signal, locale, intent }) => Promise<AddressSuggestion[]>RequiredFinds addresses for the text. signal is cancelled when a new search starts, locale is the page’s language, and intent is "suggest" (a pause in typing) or "submit" (Enter or Search). Return a list; an empty list means nothing was found, and a rejected promise shows the error text.
resolve(suggestion, options: { signal, locale }) => Promise<AddressResult>–Adds the position to a suggestion that has none. It is called once, when the visitor picks. Without it, every suggestion needs a position in search, or picking it shows the error text.
structured(parts, options) => Promise<AddressResult | null>–Looks up an address whose parts are known. AddressInput uses it for a house number. AddressSearch does not call it.

AddressResult

Renders nothing: it is the object onResult gets. A suggestion in the list has the same fields, and can leave out position when resolve adds it.

PropTypeDefaultDescription
idstringRequiredA stable id, used as the option’s key.
labelstringRequiredThe address as one line of text, with the town: “Drottninggatan 6, 111 51 Stockholm”. It is the option’s name, the text that fills the field and the address in the announcement after a pick.
position{ longitude: number; latitude: number }RequiredWhere the address is.
bounds{ west, south, east, north }–The box around the place, for a street or an area. A map fits its view to it.
address{ line1, postalCode, city, country }–The parts of a postal address, for filling in a form. country is a two-letter ISO 3166-1 code in upper case, such as SE. A result without it fills nothing in a form.
precision'address' | 'street' | 'place'–How exact the result is: an address with a house number, a street without one, or a place such as a town. Left out when the service can’t tell.

useAddressSearch

The state and props behind the field, for when you draw your own. It takes the same options as AddressSearch.Root and needs a KvirnProvider. It returns everything useAutocomplete returns (inputProps, popupProps, listProps, getOptionProps and the open state), plus the values below. The words in the result are the same texts as the parts show.

Options

PropTypeDefaultDescription
geocoderGeocoderProviderRequiredThe service that finds addresses, as an object (see GeocoderProvider below). Make it once, outside your component. Its name is shown in the privacy notice. Geocoders come from @kvirn-ui/map: kvirnGeocoder (from @kvirn-ui/map/kvirn), nominatim (@kvirn-ui/map/nominatim) and googlePlaces (@kvirn-ui/map/google-places). You can also write your own. Nothing is sent before the visitor types and, on request, presses Search. What is typed, and the visitor’s IP address, reach this service, so name it in your privacy notice. KvirnUI recommends neither Nominatim nor Google for forms that residents fill in: read their terms first.
onResult(result: AddressResult | null) => void–Called once with the address the visitor picks, with its position. Called with null when the visitor clears the field with Clear after a pick. It never moves focus. With a map, call show(result) and clearResult() on it. In a form, write result.address into your address boxes.
minLengthnumber3The fewest characters, after trimming spaces, before a search is sent. Below it, as you type, nothing is sent or said. On request, Enter or Search says how many characters are needed. The Kvirn map service needs at least 2.
debouncenumber | false400Milliseconds of no typing before a search as you type. false, or a geocoder without suggest: true, searches on request: Enter or the Search button.
timeoutMillisecondsnumber10000How long to wait for an answer, in milliseconds. After that the search counts as failed and the error text shows.
countrystring–A country as an ISO 3166-1 code, such as SE. It is sent to the geocoder, which ranks that country first. Results in other countries are still listed.
limitToCountrybooleanfalseWith country: drops the results that have an address in another country, for a form that can’t record one.
describePick(result: AddressResult, messages) => { rejected: string } | { announcement: string }–Decides what a pick means before onResult runs. { rejected } keeps the list open, restores the text the visitor typed, shows that text on the status line and announces it, and onResult is not called. { announcement } is announced instead of the picked text.
initialTextstring–The text the input starts with, for a field that already holds a value.
disabledbooleanfalseDisables the field and the Search button.
idstring–The id of the input. Without one the field makes its own.
messagesPartial<KvirnMessages["addressSearch"]>–Changes the texts of this field only. See Strings below for every key and its English text.

Result

PropTypeDefaultDescription
statusAddressSearchStateRequiredWhat the search is doing: idle, too-short, searching, results, empty, error, offline, selected or rejected (describePick turned a pick down).
resultsreadonly AddressSuggestion[]RequiredThe latest answer. Earlier results stay listed while the next search runs.
isOnRequestbooleanRequiredTrue when only Enter or the Search button sends a search.
search() => voidRequiredSearches now, as Enter and Search do.
submitPropsobjectRequiredSpread on the Search button. Show the button only while isOnRequest is true. It is a type="button" and never submits a form.
statusPropsobjectRequiredSpread on the line above the suggestions. It carries data-state.
statusTextstring | undefinedRequiredThe words for the status line. There are none for idle, results and selected.
labelTextstringRequiredThe default label text.
helpTextstringRequiredThe default help text for the current mode.
noticeTextstringRequiredThe default privacy notice text.
attributionstring | undefinedRequiredThe geocoder’s credit text, to show after the notice.
submitTextstringRequiredThe default text of the Search button.

Strings

These are the default texts in @kvirn-ui/i18n.

For your whole app, pass messages to KvirnProvider. For one AddressSearch, pass its messages prop.

The texts exist in all five languages. Have a native speaker review the Swedish, Finnish and Norwegian ones before you launch. The geocoder’s name and the addresses it returns are yours, so write them in the page’s language.

addressSearch.label

The default label of the field.

LanguageDefault text
SvenskaHitta en adress
SuomiHae osoite
Norsk bokmålFinn en adresse
Norsk nynorskFinn ei adresse
EnglishFind an address

addressSearch.helpSuggest

The help text when the search runs as you type.

LanguageDefault text
SvenskaSkriv minst 3 tecken av en gata, ett postnummer eller en ort. Välj sedan en adress i listan.
SuomiKirjoita vähintään 3 merkkiä kadusta, postinumerosta tai paikkakunnasta. Valitse sitten osoite luettelosta.
Norsk bokmålSkriv minst 3 tegn av en gate, et postnummer eller et sted. Velg deretter en adresse fra listen.
Norsk nynorskSkriv minst 3 teikn av ein gate, eit postnummer eller ein stad. Vel deretter ei adresse frå lista.
EnglishType at least 3 characters of a street, postal code or place. Then choose an address from the list.

addressSearch.helpRequest

The help text when the search runs on request (Enter or Search).

LanguageDefault text
SvenskaSkriv en gata och ett nummer, ett postnummer eller en ort. Tryck sedan på Sök.
SuomiKirjoita katu ja numero, postinumero tai paikkakunta. Paina sitten Hae.
Norsk bokmålSkriv en gate og et nummer, et postnummer eller et sted. Trykk deretter på Søk.
Norsk nynorskSkriv ein gate og eit nummer, eit postnummer eller ein stad. Trykk deretter på Søk.
EnglishType a street and number, a postal code or a place. Then press Search.

addressSearch.submit

The name of the Search button, which shows only when the search runs on request.

LanguageDefault text
SvenskaSök
SuomiHae
Norsk bokmålSøk
Norsk nynorskSøk
EnglishSearch

addressSearch.privacy

The notice that says where the typed text goes, with the name of the service.

LanguageDefault text
SvenskaDet du skriver skickas till the Kvirn map service för att hitta adressen.
SuomiKirjoittamasi teksti lähetetään palveluun the Kvirn map service osoitteen hakemiseksi.
Norsk bokmålDet du skriver, sendes til the Kvirn map service for å finne adressen.
Norsk nynorskDet du skriv, blir sendt til the Kvirn map service for å finne adressa.
EnglishWhat you type is sent to the Kvirn map service to find the address.

addressSearch.privacyUnnamed

The notice when the geocoder has no name.

LanguageDefault text
SvenskaDet du skriver skickas till en adresstjänst för att hitta adressen.
SuomiKirjoittamasi teksti lähetetään osoitepalveluun osoitteen hakemiseksi.
Norsk bokmålDet du skriver, sendes til en adressetjeneste for å finne adressen.
Norsk nynorskDet du skriv, blir sendt til ei adresseteneste for å finne adressa.
EnglishWhat you type is sent to an address service to find the address.

addressSearch.tooShort

Shown and announced when the search runs on request and the text is shorter than minLength.

LanguageDefault text
SvenskaSkriv minst 3 tecken för att söka.
SuomiKirjoita vähintään 3 merkkiä hakeaksesi.
Norsk bokmålSkriv minst 3 tegn for å søke.
Norsk nynorskSkriv minst 3 teikn for å søkje.
EnglishType at least 3 characters to search.

addressSearch.searching

Shown and announced when a request is on its way. It is left out when the answer is quick.

LanguageDefault text
SvenskaSöker efter adresser
SuomiHaetaan osoitteita
Norsk bokmålSøker etter adresser
Norsk nynorskSøkjer etter adresser
EnglishSearching for addresses

addressSearch.resultCount

Announced with the number of addresses found.

LanguageDefault text
Svenska2 adresser hittades
Suomi2 osoitetta löytyi
Norsk bokmål2 adresser funnet
Norsk nynorsk2 adresser funne
English2 addresses found

addressSearch.noResults

Shown and announced when nothing is found. It is not an error.

LanguageDefault text
SvenskaIngen adress hittades för ”Storgatn”. Kontrollera stavningen eller lägg till orten.
SuomiOsoitetta ”Storgatn” ei löytynyt. Tarkista kirjoitusasu tai lisää paikkakunta.
Norsk bokmålFant ingen adresse for «Storgatn». Sjekk stavemåten, eller legg til stedet.
Norsk nynorskFann inga adresse for «Storgatn». Sjekk stavemåten, eller legg til staden.
EnglishNo address found for “Storgatn”. Check the spelling, or add the town.

addressSearch.error

Shown and announced when the search fails or takes too long.

LanguageDefault text
SvenskaAdresssökningen fungerar inte just nu. Försök igen om en stund.
SuomiOsoitehaku ei toimi juuri nyt. Yritä hetken kuluttua uudelleen.
Norsk bokmålAdressesøket fungerer ikke akkurat nå. Prøv igjen om litt.
Norsk nynorskAdressesøket fungerer ikkje akkurat no. Prøv igjen om litt.
EnglishThe address search isn’t working right now. Try again in a moment.

addressSearch.offline

Shown and announced when the visitor is offline. No request is sent.

LanguageDefault text
SvenskaDu är offline. Anslut till internet och sök igen.
SuomiOlet offline-tilassa. Yhdistä internetiin ja hae uudelleen.
Norsk bokmålDu er frakoblet. Koble til internett og søk på nytt.
Norsk nynorskDu er fråkopla. Kopl til internett og søk på nytt.
EnglishYou’re offline. Connect to the internet, then search again.

addressSearch.picked

Announced after a pick.

LanguageDefault text
SvenskaVald: Drottninggatan 6, 111 51 Stockholm.
SuomiValittu: Drottninggatan 6, 111 51 Stockholm.
Norsk bokmålValgt: Drottninggatan 6, 111 51 Stockholm.
Norsk nynorskVald: Drottninggatan 6, 111 51 Stockholm.
EnglishChosen: Drottninggatan 6, 111 51 Stockholm.

addressSearch.pickedFilled

Announced after a pick when the result fills in a form. Pass it as picked, for one field.

LanguageDefault text
SvenskaVald: Drottninggatan 6, 111 51 Stockholm. Adressen är ifylld nedan. Kontrollera den innan du fortsätter.
SuomiValittu: Drottninggatan 6, 111 51 Stockholm. Osoite on täytetty alle. Tarkista se ennen kuin jatkat.
Norsk bokmålValgt: Drottninggatan 6, 111 51 Stockholm. Adressen er fylt ut nedenfor. Sjekk den før du fortsetter.
Norsk nynorskVald: Drottninggatan 6, 111 51 Stockholm. Adressa er fylt ut nedanfor. Sjekk ho før du held fram.
EnglishChosen: Drottninggatan 6, 111 51 Stockholm. The address is filled in below. Check it before you continue.

These are the default texts in @kvirn-ui/i18n.

This text belongs to the Map. It is said when a pick moves the map beside the field, and messages on Map.Root or the provider replaces it.

map.addressShown

Announced when the map has moved to the picked address. The places in view follow it.

LanguageDefault text
SvenskaKartan visar adressen.
SuomiKartta näyttää osoitteen.
Norsk bokmålKartet viser adressen.
Norsk nynorskKartet viser adressa.
EnglishThe map shows the address.

Known issues#

  • Review the translations before you launch. Have a native speaker review the Swedish, Finnish, Norwegian Bokmål and Norwegian Nynorsk texts.
  • "Chosen" may be heard twice. Some screen readers also read the new value of the field. Check it with your users' assistive technology.
  • Test with your users and their assistive technology.

Information: Did you know?

If an issue here affects your service, list it in your accessibility statement with its workaround.

Testing#

The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.

AT + browser + OSAgent checkHuman checkResultNotes
Automated (re-runnable tests)
axe, WCAG 2.2 A and AA, every story, 4 themespassn/apassaddress-search.stories.tsx, every story except LiveWithMap (it calls the network), 4 themes
Markup and ARIA (roles, names, ids, states)passn/apass2026-10-24: address-search.test.tsx › renders the ARIA 1.2 combobox, named by the visible label and described by the help text, then the notice, and › AddressSearch read aloud (role, name and state per phrase); address-search.stories.tsx axe, 4 themes
Keyboard contract rows (Vitest browser)passn/apassevery row names a test in address-search.test.tsx or autocomplete.test.tsx
Focus order and managementpassn/apassaddress-search.test.tsx asserts focus (toHaveFocus) after Tab, a pick, Clear and a map move: pick with Enter: the text becomes the label, onResult is called once, focus stays and picked is announced
Display modes (forced colours, 320px reflow, text spacing, reduced motion)passn/apassaddress-search.stories.tsx in the four sweep projects (map is in sweepComponents, vite.config.ts), all four re-run 2026-10-23 on the final theme.css, green
Core (required for beta)
NVDA + Chrome + Windowspasspendingpendingagent 2026-10-24: address-search.test.tsx › AddressSearch read aloud and › AddressSearch with a map (readAloud, readAnnouncements), every Keyboard row test, the four sweeps (Chromium)
VoiceOver + Safari + iOSpendingpendingpending
Release (before 1.0 and each minor)
JAWS + Chrome + Windowspendingpendingpending
TalkBack + Chrome + Androidpendingpendingpending
VoiceOver + Safari + macOSpendingpendingpending

What to check#

  • Tab to the field. A screen reader reads the label, the help text and where the typed text goes. On request, one more Tab reaches the Search button. Clear is not a Tab stop.
  • Type a few characters, then press Enter or Search. A message may say that the search is running, and then says how many addresses were found. Typing alone sends nothing on request.
  • Press ArrowDown to move through the list: each address is read. Press Enter to choose one. The address fills the field, focus stays in the field and "Chosen" is heard.
  • Search for text that matches nothing, for fewer characters than the minimum, and with the network off. Each gives a message that says what to do next.
  • In a form, press Enter in the search: it searches and the form is not sent. After a pick the address boxes are filled in and can still be edited.
  • Beside a map, choose an address. The map moves and shows a pin, and "The map shows the address" is heard once the map settles. Focus stays in the field.