Skip to Content
dk-address

Introduction

Danish address autocomplete for React, built on KDS Adressevælger, the replacement for DAWA's autocomplete.

KDS Adressevælger

dk-address is an address field for Danish addresses. People type a street name, pick a house number and a unit, and your app gets the full address with its id, postal code, municipality and position.

Get started

Install the package and render a field in two steps, then see what happens when someone picks a suggestion:

What is KDS Adressevælger?

KDS Adressevælger is the address search API from Klimadatastyrelsen (KDS), the Danish Agency for Climate Data. It searches Danmarks Adresseregister (DAR), the national address register, and replaces DAWA's autocomplete. New and changed addresses are searchable the day after they're registered.

You don't need to sign up. Until KDS introduces user management, everyone uses the same shared token, and dk-address sends it for you.

What dk-address adds

KDS returns suggestions, but turning them into a field people can fill in takes more than a list. dk-address handles:

  • Caret placement: picking a street leaves the caret where the house number goes (Vesterbrogade |, 1620 København V), and picking a building leaves it where floor and door go. KDS's own component does neither.
  • House numbers by prefix: KDS only matches whole house numbers, so 2 finds nothing on the way to 28. Once a street is picked, dk-address matches its house numbers as you type.
  • English, typed results: one Suggestion type with English field names instead of KDS's five Danish result shapes, and errors you can catch instead of Danish text.
  • Your UI: unstyled parts that take your className, ready blocks for shadcn/ui and Ant Design, or a hook for any other autocomplete.

KDS also publishes its own JavaScript component. Compared with KDS's component puts the two side by side, from installing to what your code depends on.

Packages

Most apps only install @dk-address/react. It brings the other two along:

PackageUse it to
@dk-address/reactRender the address field in React
@dk-address/coreGet the same behaviour without React
@dk-address/clientCall KDS yourself, with English types and errors

To import from core or client in a React app, for example createClient() in your tests, add that package to your dependencies too.