Skip to Content
dk-address

Compared with KDS's component

How dk-address differs from the Adressevælger component that KDS publishes on GitHub.

KDS publishes its own address field: a JavaScript component, distributed on GitHub. Both search the same KDS API and find the same addresses. They differ in how you install and type them, in how the field behaves while people fill it in, and in what your code depends on. This page compares against version 5.0.1 of KDS's component, the current version in November 2026.

At a glance

KDS's componentdk-address
InstallCopy files from GitHub, again for every updatenpm i @dk-address/react
TypesNone: plain JavaScriptTypeScript types for every option, suggestion and address
Option and field namesDanish, as KDS sends themEnglish
Your code readsKDS's response formatdk-address's types, with KDS's object as raw
After picking a streetThe text is replaced; the caret isn't placedThe caret goes where the house number goes
House numbersWhole numbers only: 2 doesn't find 28Matched by prefix as you type
Waits before searching500 ms (300 ms in the web component)100 ms, and no wait after a pick
StylingGlobal CSS classes on a list it rendersYour className on each part, or blocks for shadcn/ui and Ant Design
Keyboard focusArrow keys move focus from the input into the listFocus stays in the input, following the ARIA combobox pattern
Removing itNo method to remove the DOM versionComponents and hooks clean up when they unmount
TokenRequired optionKDS's shared token by default

Installing and updating

KDS distributes its component only through GitHub. You copy adressevaelger.iife.js or adressevaelger.esm.js and the stylesheet into your project, and copy them again for every new version. dk-address is a set of npm packages, so updates come through your package manager and your lockfile.

Types and names

KDS's component is plain JavaScript without type definitions. Its options use KDS's Danish parameter names, and select receives KDS's response object as it is. dk-address types every option and result, with English names:

KDS's componentdk-address
kommuneKode: "0101"municipalityCodes: ["0101"]
maksimum: 20limit: 20
medtagForeloebige: trueincludeProvisional: true
adgangsadresserOnly: truekind: "accessAddress"
select(selected), KDS's objectonSelect(selection), a typed address in selection.details

Protection from API changes

Moving from DAWA to KDS changed the response format, so apps that read DAWA's fields had to change wherever they read an address. With KDS's component, your code reads KDS's response directly, and the next change at KDS reaches your code the same way.

With dk-address, your code reads dk-address's types instead. A change at KDS is handled by updating dk-address, not in every component that reads an address. When you need a field dk-address doesn't map, the untouched KDS object is still there as raw.

Filling in an address

Both components refine: picking a street searches again within that street. They differ in what happens next:

  • Caret placement: KDS's component replaces the text with the street and leaves the caret wherever the browser puts it. dk-address puts the caret where the house number goes (Vesterbrogade |, 1620 København V), and after a building, where floor and door go.
  • House numbers: KDS matches whole house numbers only, so with KDS's component Vesterbrogade 2, 1620 finds nothing on the way to 28. dk-address also matches the street's house numbers by prefix.
  • Gap hints: dk-address tells your UI which part the caret is in (houseNumber or unit), so you can show a hint like "Type the house number".

How it works walks through each step.

Styling, React and keyboard

KDS's component renders its own list, styled with global CSS classes (.adressevaelger-suggestions, .dawa-selected) and positioned inside a wrapper div you add. dk-address renders unstyled parts that take your className and positions the popup against the input, flipping it when there's no room. If you use a component library, you can skip dk-address's UI and drive the library's own autocomplete instead.

The DOM version of KDS's component adds a document-wide click listener and has no method to remove it, which matters when React mounts and unmounts the field. dk-address's components and hooks cancel pending requests and clean up when they unmount.

With KDS's component, the arrow keys move focus out of the input and into the list. dk-address keeps focus in the input, as the ARIA combobox pattern describes, so people can keep typing while they browse suggestions.

When KDS's component fits better

KDS's component needs no build step: one script tag and one stylesheet give you a working field. On a page without npm or a bundler, that's less setup than dk-address, which you install from npm.