Address autocomplete for KDS Adressevælger
KDS Adressevælger replaces DAWA's autocomplete. dk-address turns it into a Danish address field for React, from street name to floor and door.
npm i @dk-address/reactonSelect(selection.details)
Pick a street, then a house number. The caret waits where each part goes.
What dk-address adds to KDS Adressevælger
The caret moves to the next part
Picking a street leaves the caret where the house number goes. Picking a building leaves it where floor and door go.
House numbers match as you type
KDS only matches whole house numbers. dk-address matches a street's numbers by prefix, so
2already finds28.Your styles or your library
Unstyled parts that take your classes, ready blocks for shadcn/ui and Ant Design, or a hook for any other autocomplete.
Compared with KDS's own component
KDS publishes a JavaScript component on GitHub. Both find the same addresses; here's what changes for your code and for the people filling in the field.
| Topic | KDS's component | dk-address |
|---|---|---|
| Install | Copy files from GitHub, again for every update | npm i @dk-address/react |
| Types | None: plain JavaScript | TypeScript, with English names |
| Your code reads | KDS's response format, so KDS's API changes reach your code | dk-address's types, so API changes are handled in an update |
| After picking a street | The text is replaced; the caret isn't placed | The caret goes where the house number goes |
| House numbers | Whole numbers only: 2 doesn't find 28 | Matched by prefix as you type |
| Styling | Global CSS classes | Your classes on each part, or shadcn/ui and Ant Design blocks |
Start from what you already use
Every path uses the same search and caret handling. Only the UI around it changes.
shadcn/ui
A styled field you copy into components/ui and own.
Ant Design
An AutoComplete that works as a Form.Item control.
Tailwind or your own CSS
Style the unstyled parts and wrap them in your own field.
MUI, Mantine and others
Drive your library's own autocomplete with a hook.
For apps without React, @dk-address/core has the same behaviour without a framework.