# ViraStack Address (full)
> `@virastack/address` (1.0.x): headless Turkish address hook for React. Chained province (il), district (ilçe) and neighbourhood (mahalle) selects, derived postal codes, server validation and the bundled PTT dataset. Zero runtime dependencies. Not a component: no markup, no styles.
## Install
```bash
npm install @virastack/address
# peer: react >= 18.2 (optional for the /server and /data entries)
```
Docs: https://virastack.com/address/docs; Index: https://virastack.com/address/llms.txt; Repo: https://github.com/virastack/form/tree/main/packages/address
## Entry points
| Import | Exports | Runs on |
| --- | --- | --- |
| `@virastack/address` | `useViraAddress`, `formatAddress` and the helpers | client (`"use client"`) |
| `@virastack/address/server` | `resolveAddress`, `resolvePostalCode`, `districtsOf`, `findProvince`, `formatAddress`, `normalizePostalCode` | server, no React |
| `@virastack/address/data` | `provinces`, `districts`, `neighbourhoods`, `findPostalCode`, `source`, `setLoader` | client + server, no React |
## Critical rules for agents
1. One hook: `useViraAddress`. Spread `getProvinceProps()`, `getDistrictProps()` and `getNeighbourhoodProps()` on the three selects.
2. Picking a level clears the levels below it. Do not clear them by hand.
3. The postal code is derived from the neighbourhood, never typed on its own. Use `getPostalCodeInputProps()` for a typed code that fills the selects.
4. With React Hook Form, pass `form` (`useForm()` or `useFormContext()`). Fields are `province`, `district`, `neighbourhood`, `postalCode`; rename with `names`. Add `provinceCode` to `names` only when the backend wants the plate code.
5. Always validate again on the server with `resolveAddress`. A client can post any postal code.
6. Province, district and neighbourhood values are the dataset's raw names (upper case Turkish); `label` is title-cased for display.
7. Rendering is yours: pass `as` to `getXProps()` for non-native selects.
## Quick start
```tsx
import { useViraAddress } from "@virastack/address";
function AddressFields() {
const { getProvinceProps, getDistrictProps, getNeighbourhoodProps, value } = useViraAddress();
return (
<>
Posta kodu: {value.postalCode ?? "—"}
>
);
}
```
`value`:
```ts
{
provinceCode: "34",
province: "İSTANBUL",
district: "FATİH",
neighbourhood: "AKSARAY MAH.",
postalCode: "34096",
postalCodes: ["34096"], // all codes, for the few hundred neighbourhoods with several
}
```
Every list is `{ value, label }`. The hook also returns the lists and setters (`provinces`, `setProvince`, ...), `reset()`, `error`, `loading.neighbourhoods`, `setPostalCode()`, `postalCodeStatus` and `getPostalCodeInputProps()`.
## Prop getters
Each getter returns a plain `